Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
8e843831
Commit
8e843831
authored
Nov 04, 2015
by
Artur Malabarba
Browse files
* lisp/subr.el (when): Use `macroexp-progn'
* test/automated/subr-tests.el (subr-test-when): New test
parent
587b2328
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
lisp/subr.el
lisp/subr.el
+1
-1
test/automated/subr-tests.el
test/automated/subr-tests.el
+14
-0
No files found.
lisp/subr.el
View file @
8e843831
...
...
@@ -179,7 +179,7 @@ value of last one, or nil if there are none.
\(fn COND BODY...)"
(declare (indent 1) (debug t))
(list 'if cond (
cons '
progn body)))
(list 'if cond (
macroexp-
progn body)))
(defmacro unless (cond &rest body)
"If COND yields nil, do BODY, else return nil.
...
...
test/automated/subr-tests.el
View file @
8e843831
...
...
@@ -82,5 +82,19 @@
(
should
(
string-greaterp
'acb
'abc
))
(
should
(
string-greaterp
"acb"
'abc
)))
(
ert-deftest
subr-test-when
()
(
should
(
equal
(
when
t
1
)
1
))
(
should
(
equal
(
when
t
2
)
2
))
(
should
(
equal
(
when
nil
1
)
nil
))
(
should
(
equal
(
when
nil
2
)
nil
))
(
should
(
equal
(
when
t
'x
1
)
1
))
(
should
(
equal
(
when
t
'x
2
)
2
))
(
should
(
equal
(
when
nil
'x
1
)
nil
))
(
should
(
equal
(
when
nil
'x
2
)
nil
))
(
should
(
equal
(
macroexpand-all
'
(
when
a
b
))
'
(
if
a
b
)))
(
should
(
equal
(
macroexpand-all
'
(
when
a
b
c
d
))
'
(
if
a
(
progn
b
c
d
)))))
(
provide
'subr-tests
)
;;; subr-tests.el ends here
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment