diff --git a/test/smartparens-get-stringlike-expression-elisp-test.el b/test/smartparens-get-stringlike-expression-elisp-test.el new file mode 100644 index 00000000..4a79f53a --- /dev/null +++ b/test/smartparens-get-stringlike-expression-elisp-test.el @@ -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 "")) + ) diff --git a/test/smartparens-get-stringlike-expression-test.el b/test/smartparens-get-stringlike-expression-test.el index ba049408..a88696c5 100644 --- a/test/smartparens-get-stringlike-expression-test.el +++ b/test/smartparens-get-stringlike-expression-test.el @@ -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 "\"" "\"" "" "")