ESCAPE-STRING assumes the resulting string is going to be double-quoted,
and LAMBA-NAME/DOCSTRING-WRAPPER was only single quoting them.
A similar issue was present for function names with single quotes. These
should be read differently, i.e. FO'O => FO (QUOTE O), but until the
reader is fixed to deal with this I think allowing them in function
names makes more sense than failing with a strange error message
(js!selfcall
"var func = " (join strs) ";" *newline*
(when name
- (code "func.fname = '" (escape-string name) "';" *newline*))
+ (code "func.fname = \"" (escape-string name) "\";" *newline*))
(when docstring
- (code "func.docstring = '" (escape-string docstring) "';" *newline*))
+ (code "func.docstring = \"" (escape-string docstring) "\";" *newline*))
"return func;" *newline*)
(apply #'code strs)))
--- /dev/null
+;;;; Tests for DEFUN
+
+;;; Regression test for #111
+(test (eql (defun foo () "foo's" ()) 'foo))