Skip to content

Commit

Permalink
Update the newlinify macro to not externalize its environment
Browse files Browse the repository at this point in the history
The newlinify macro was externalizing its environment unnecessarily.
Though not necessarily a bug, it made the code both less efficient
and more fragile to the Lisp implementation (there is no guarantee
that environments _be_ externalizable!). Dave Cooper noticed the problem
in ACL 9.0 (where there had been changes in the environment
implementation). Now it's been improved and so no longer a problem.
  • Loading branch information
Gary King committed Mar 2, 2013
1 parent 6db065f commit ee24169
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ lift-local.config
*.fasl

benchmark-data/

# new ASDF stuff
*.*-warnings
*.build-report
8 changes: 4 additions & 4 deletions dev/macros.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,10 @@ test failure is generated instead of a warning"
(defmacro newlinify (format &environment e)
(declare (ignorable e))
#+allegro
`(if (and (constantp ,format ,e)
(stringp (sys:constant-value ,format ,e)))
(excl::newlinify-format-string (sys:constant-value ,format ,e))
,format)
(if (and (constantp format e)
(stringp (sys:constant-value format e)))
(excl::newlinify-format-string (sys:constant-value format e))
`(excl::newlinify-format-string ,format))
#-allegro
format)

Expand Down
16 changes: 8 additions & 8 deletions test/lift-test.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,18 +1092,18 @@ these cancel testing instead.)")
until (eq line :eof) collect line))))

(deftestsuite test-log-file (lift-test)
(log-file)
(my-log-file)
(:setup
(setf log-file (format nil "/tmp/~a" (gensym "file-")))
(when (probe-file log-file)
(delete-file log-file))))
(setf my-log-file (format nil "/tmp/~a" (gensym "file-")))
(when (probe-file my-log-file)
(delete-file my-log-file))))

(deftestsuite test-log-file-helper ()
(log-file))
(my-log-file))

(addtest (test-log-file-helper)
test-1
(let ((lines (slurp log-file)))
(let ((lines (slurp my-log-file)))
(ensure (plusp (length lines)))
(let* ((last-line (first (last lines)))
(datum (read-from-string last-line nil nil)))
Expand All @@ -1115,8 +1115,8 @@ these cancel testing instead.)")
test-1
(let ((r (lift:run-tests
:suite 'test-log-file-helper
:report-pathname log-file
:testsuite-initargs `(:log-file ,log-file))))
:report-pathname my-log-file
:testsuite-initargs `(:log-file ,my-log-file))))
(ensure-null (errors r))
(ensure-null (failures r))
(ensure (plusp (length (tests-run r))))))
1 change: 0 additions & 1 deletion timeout/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
(defpackage #:com.metabang.trivial-timeout
(:use #:common-lisp)
(:nicknames #:trivial-timeout)
; #+no
(:export
#:with-timeout
#:timeout-error)))

0 comments on commit ee24169

Please sign in to comment.