Commit 948dc368 authored by Joao Tavora's avatar Joao Tavora
Browse files

Fix slime-repl failures when run standalone

When run without slime-presentations, slime-repl exhibited some test
failures. This is a "sanity" fix so the current tests can be used as reference
for a possible redesign that eventually handles #9 and maybe implements the
behaviour described in #84.

* .travis.yml (env): Test the slime-repl independently from other
contribs like slime-presentations.

* slime.el (slime-propertize-region): Add edebug spec.

* contrib/slime-presentations.el (pretty-presentation-results): new tests,
should be more stable, except on allegro.

* contrib/slime-repl.el (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.
parent a2222859
Showing with 64 additions and 11 deletions
+64 -11
......@@ -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
......
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
......
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>
......
......@@ -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)
......@@ -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
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment