Skip to content

Commit

Permalink
New-style tests for strings in elisp, forward
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuco1 committed Jan 19, 2016
1 parent 05ba1d2 commit 444c89a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
30 changes: 30 additions & 0 deletions test/smartparens-get-stringlike-expression-elisp-test.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(defun sp-test--stringlike-expression-parse-in-elisp (initial result &optional back)
(sp-test-with-temp-elisp-buffer initial
(should (equal (sp-get-stringlike-expression back) result))))

(ert-deftest sp-test-get-stringlike-expression-elisp ()
"Test basic stringlike expressions in `emacs-lisp-mode'."
(sp-test--stringlike-expression-parse-in-elisp "|foo \"bar\" baz \"quux\" bux" '(:beg 5 :end 10 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo |\"bar\" baz \"quux\" bux" '(:beg 5 :end 10 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"|bar\" baz \"quux\" bux" '(:beg 5 :end 10 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"ba|r\" baz \"quux\" bux" '(:beg 5 :end 10 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"bar|\" baz \"quux\" bux" '(:beg 5 :end 10 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"bar\"| baz \"quux\" bux" '(:beg 15 :end 21 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"bar\" b|az \"quux\" bux" '(:beg 15 :end 21 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"bar\" baz| \"quux\" bux" '(:beg 15 :end 21 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"bar\" baz |\"quux\" bux" '(:beg 15 :end 21 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"bar\" baz \"qu|ux\" bux" '(:beg 15 :end 21 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"bar\" baz \"quux|\" bux" '(:beg 15 :end 21 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "|foo \"b\\\"ar\" baz \"q\\\"uux\" bux" '(:beg 5 :end 12 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo |\"b\\\"ar\" baz \"q\\\"uux\" bux" '(:beg 5 :end 12 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"b\\\"a|r\" baz \"q\\\"uux\" bux" '(:beg 5 :end 12 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"b\\\"ar\"| baz \"q\\\"uux\" bux" '(:beg 17 :end 25 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"b\\\"ar\" baz |\"q\\\"uux\" bux" '(:beg 17 :end 25 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \"b\\\"ar\" baz \"q\\\"uu|x\" bux" '(:beg 17 :end 25 :op "\"" :cl "\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "|foo \\\"bar\\\" baz bam \\\"quux\\\"" '(:beg 5 :end 12 :op "\\\"" :cl "\\\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo |\\\"bar\\\" baz bam \\\"quux\\\"" '(:beg 5 :end 12 :op "\\\"" :cl "\\\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \\\"b|ar\\\" baz bam \\\"quux\\\"" '(:beg 5 :end 12 :op "\\\"" :cl "\\\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \\\"bar\\\"| baz bam \\\"quux\\\"" '(:beg 21 :end 29 :op "\\\"" :cl "\\\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \\\"bar\\\" baz bam |\\\"quux\\\"" '(:beg 21 :end 29 :op "\\\"" :cl "\\\"" :prefix "" :suffix ""))
(sp-test--stringlike-expression-parse-in-elisp "foo \\\"bar\\\" baz bam \\\"quu|x\\\"" '(:beg 21 :end 29 :op "\\\"" :cl "\\\"" :prefix "" :suffix ""))
)
6 changes: 0 additions & 6 deletions test/smartparens-get-stringlike-expression-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
("foo \\\"bar\\\" baz bam \\\"quux\\\"" 25 21 29 "\\\"" "\\\"" "" "")
))

(ert-deftest sp-test-get-stringlike-expression ()
"Test basic stringlike expressions in `emacs-lisp-mode'."
(sp-test-setup-stringlike-expression-env-basic
(--each sp-test-get-stringlike-expression
(sp-test-stringlike-sexp (car it) (apply 'sp-test-make-pair (cddr it)) (cadr it) nil nil))))

(defvar sp-test-get-stringlike-expression-backward
'(("foo \"bar\" baz \"quux\" bux" 15 5 10 "\"" "\"" "" "")
("foo \"bar\" baz \"quux\" bux" 12 5 10 "\"" "\"" "" "")
Expand Down

0 comments on commit 444c89a

Please sign in to comment.