diff --git a/README.md b/README.md index 728fd6b..6fbbb3c 100644 --- a/README.md +++ b/README.md @@ -215,4 +215,4 @@ parsed at read time and prepared to be executed at runtime. In the 'bang' forms only simple shell commands can be issued as the reader does not detect the circumstances when a construct (such as ca '`case`') occupies more than one line. In the embedded form or with -the script command, any script can be executed. \ No newline at end of file +the script command, any script can be executed. diff --git a/clesh-tests.asd b/clesh-tests.asd index 5b439ee..0e660d1 100644 --- a/clesh-tests.asd +++ b/clesh-tests.asd @@ -8,4 +8,4 @@ :description ("Unit tests for clesn To run the tests, load this package and -evaluate (lisp-unit:run-all-tests clesh)")) \ No newline at end of file +evaluate (lisp-unit:run-all-tests clesh-tests)")) diff --git a/clesh-tests.lisp b/clesh-tests.lisp index 6ea9e95..1b5a222 100644 --- a/clesh-tests.lisp +++ b/clesh-tests.lisp @@ -1,7 +1,11 @@ -(in-package clesh) +(defpackage #:clesh-tests + (:use #:cl + #:clesh + #:lisp-unit) + (:import-from #:clesh + #:read-interpolated-string)) -(eval-when (:compile-toplevel :load-toplevel) - (use-package 'lisp-unit)) +(in-package #:clesh-tests) (define-test read-interpolated-string (assert-equal diff --git a/clesh.lisp b/clesh.lisp index 6b20974..2aa652d 100644 --- a/clesh.lisp +++ b/clesh.lisp @@ -187,12 +187,11 @@ will be read as (\"asd foo \" (+ 2 2) \" bar \" (+ 3 3))." (defun simple-shell-escape-reader (stream char) (declare (ignore char)) - (let* ((ll - (apply 'concatenate 'string - (read-interpolated-string stream #\Newline nil t)))) + (let* ((ll (apply 'concatenate 'string + (read-interpolated-string stream #\Newline nil t)))) (if (and (> (length ll) 0) (string= (subseq ll 0 1) "!")) - (enter-shell-mode stream) - (princ (script ll)))) + (enter-shell-mode stream) + (princ (script ll)))) nil) (defun embedded-shell-escape-reader (stream char) @@ -209,8 +208,8 @@ will be read as (\"asd foo \" (+ 2 2) \" bar \" (+ 3 3))." (defreadtable clesh:syntax (:merge :standard) - (:macro-char #\! 'simple-shell-escape-reader nil) - (:macro-char #\[ 'embedded-shell-escape-reader nil) + (:macro-char #\! #'simple-shell-escape-reader nil) + (:macro-char #\[ #'embedded-shell-escape-reader nil) ;; Ignore closing brackets when reading them (:macro-char #\] #'(lambda (stream char) (declare (ignore stream char)) @@ -218,6 +217,6 @@ will be read as (\"asd foo \" (+ 2 2) \" bar \" (+ 3 3))." (:macro-char #\} #'(lambda (stream char) (declare (ignore stream char)) (values))) - (:dispatch-macro-char #\# #\[ 'template-escape-reader) - (:dispatch-macro-char #\# #\{ 'storable-template-escape-reader)) + (:dispatch-macro-char #\# #\[ #'template-escape-reader) + (:dispatch-macro-char #\# #\{ #'storable-template-escape-reader))