diff --git a/.travis.yml b/.travis.yml index 87c92f3e4f5d26380622233e4e3fca627cec26a3..43ec2e9f1d2080afc8d78c3e9f0d344ab93adbae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,9 @@ env: - "CHECK_TARGET=check LISP=cmucl EMACS=emacs24" - "CHECK_TARGET=check-fancy LISP=sbcl32 EMACS=emacs24" - "CHECK_TARGET=check-fancy LISP=cmucl EMACS=emacs24" + # also, for emacs24 and sbcl32 test the slime-repl only + # + - "CHECK_TARGET=check-repl LISP=sbcl32 EMACS=emacs24" global: # - SOME_TOKEN=some_value diff --git a/ChangeLog b/ChangeLog index d45c1f77e463e8ad6b36667a8336b02cbb910ebd..8266081f27bc64b2fa2b5a7a62de6a9d230dd774 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-01-23 Jo茫o T谩vora <joaotavora@gmail.com> + + * .travis.yml (env): Test the slime-repl independently from other + contribs like slime-presentations. + + * slime.el (slime-propertize-region): Add edebug spec. + 2014-01-22 Jo茫o T谩vora <joaotavora@gmail.com> * swank.lisp (inspector-nth-part): Don't break if index out of diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 8d1bd718bd824427489821a2532cb79ab82f00c0..72708989592818c04bdb31f637b538f906a9f202 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,5 +1,8 @@ 2014-01-23 Jo茫o T谩vora <joaotavora@gmail.com> + * slime-presentations.el (pretty-presentation-results): new tests, + should be more stable, except on allegro. + * slime-repl.el (slime-repl-emit): Propertize the output text with a `slime-repl-output' boolean property. (slime-repl-test-markers): More powerful macro for testing repl text. @@ -8,6 +11,12 @@ (repl-test): tests with no output don't expect these markers. (repl-type-ahead): tests with no output don't expect these markers. + (slime-repl-emit-result): Use `insert-before-markers-and-inherit', and + do it before saving `slime-output-end'. + (slime-repl-write-string): Fix failing tests by passing `eol' as t + to `slime-repl-emit-result'. + (slime-repl-test-markers): Friendlier test assertions. + (repl-test-2): Skip for now, unstable without slime-presentations. 2014-01-22 Jo茫o T谩vora <joaotavora@gmail.com> diff --git a/contrib/slime-presentations.el b/contrib/slime-presentations.el index 9de891d8b52836a465220adadb5e0bcce1451efb..9cbe0220e5840b80116b95ddf3e4b2c1970442fa 100644 --- a/contrib/slime-presentations.el +++ b/contrib/slime-presentations.el @@ -885,4 +885,29 @@ even on Common Lisp implementations without weak hash tables." (assert-it 11) (assert-it 12 t)))) +(def-slime-test (pretty-presentation-results (:fails-for "allegro")) + (input result-contents) + "Test some more simple situations dealing with print-width and stuff. + +Very much like `repl-test-2', but should be more stable when +presentations are enabled, except in allegro." + '(("(with-standard-io-syntax + (write (make-list 15 :initial-element '(1 . 2)) :pretty t) 0)" + "SWANK> (with-standard-io-syntax + (write (make-list 15 :initial-element '(1 . 2)) :pretty t) 0) +{((1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) + (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2)) +}0 +SWANK> *[]") + ;; Two times to test the effect of FRESH-LINE. + ("(with-standard-io-syntax + (write (make-list 15 :initial-element '(1 . 2)) :pretty t) 0)" + "SWANK> (with-standard-io-syntax + (write (make-list 15 :initial-element '(1 . 2)) :pretty t) 0) +{((1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) + (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2)) +}0 +SWANK> *[]")) + (slime-test-repl-test input result-contents)) + (provide 'slime-presentations) diff --git a/contrib/slime-repl.el b/contrib/slime-repl.el index 9c519c773cf2338f5c7f4bab38ef7b3a31709e5f..2d74e94cba3710c2e321695a7deb780bdb2dfae2 100644 --- a/contrib/slime-repl.el +++ b/contrib/slime-repl.el @@ -244,7 +244,7 @@ hashtable `slime-output-target-to-marker'; output is inserted at this marker." (defun slime-repl-write-string (string &optional target) (case target ((nil) (slime-repl-emit string)) - (:repl-result (slime-repl-emit-result string)) + (:repl-result (slime-repl-emit-result string t)) (t (slime-emit-to-target string target)))) (defvar slime-repl-popup-on-output nil @@ -283,10 +283,11 @@ This is set to nil after displaying the buffer.") ;; insert STRING and mark it as evaluation result (with-current-buffer (slime-output-buffer) (save-excursion + (goto-char slime-repl-input-start-mark) (slime-save-marker slime-output-start + (goto-char slime-repl-input-start-mark) + (when (and bol (not (bolp))) (insert-before-markers-and-inherit "\n")) (slime-save-marker slime-output-end - (goto-char slime-repl-input-start-mark) - (when (and bol (not (bolp))) (insert-before-markers "\n")) (slime-propertize-region `(face slime-repl-result-face rear-nonsticky (face)) (insert-before-markers string))))) @@ -1784,22 +1785,28 @@ for the string sig SIG, the latter by evaling FORM in the test buffer." into expected-bindings collect `(,observed-sym ,observer-form) into observed-bindings - collect `(should (or (and (null ,observed-sym) - (null ,expected-sym)) - (and ,observed-sym - ,expected-sym - (= ,observed-sym ,expected-sym)))) + collect `(when (and ,observed-sym (not ,expected-sym)) + (ert-fail (format "Didn't expect to observe %s, but did and its %s" + ',marker ,observed-sym))) + into assertions + collect `(when (and (not ,observed-sym) ,expected-sym) + (ert-fail (format "Expected %s to be %s, bit didn't observe anything" + ',marker ,expected-sym))) + into assertions + collect `(when (and ,observed-sym ,expected-sym) + (should (= ,observed-sym ,expected-sym))) into assertions finally (return `(progn (let (,@observed-bindings - (observed-string (buffer-string))) + (observed-string (buffer-substring-no-properties (point-min) + (point-max)))) (with-current-buffer (get-buffer-create "*slime-repl test buffer*") (erase-buffer) (insert ,expected-string-spec) (let (,@expected-bindings) (should - (string= observed-string (buffer-string))) + (equal observed-string (buffer-string))) ,@assertions))))))) (defun slime-check-buffer-contents (_msg expected-string-spec) @@ -1904,7 +1911,7 @@ SWANK> *[]")) (slime-sync-to-top-level 5) (slime-check-buffer-contents "Buffer contains result" result-contents))) -(def-slime-test (repl-test-2 (:fails-for "allegro")) +(def-slime-test repl-test-2 (input result-contents) "Test some more simple situations dealing with print-width and stuff" '(("(with-standard-io-syntax @@ -1924,6 +1931,7 @@ SWANK> *[]") (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2) (1 . 2)) }0 SWANK> *[]")) + (slime-skip-test "Repl test is unstable without the slime-presentations contrib.") (slime-test-repl-test input result-contents)) (def-slime-test repl-return diff --git a/slime.el b/slime.el index 3d23cce5e85d399d2b6ae306e2a2196984c58ce2..39f3d41cffb90ae0fc2f59cfd0fb3dda7f801132 100644 --- a/slime.el +++ b/slime.el @@ -834,6 +834,7 @@ symbol at point, or if QUERY is non-nil." "Execute BODY and add PROPS to all the text it inserts. More precisely, PROPS are added to the region between the point's positions before and after executing BODY." + (declare (debug (sexp &rest form))) (let ((start (cl-gensym))) `(let ((,start (point))) (prog1 (progn ,@body)