4 (defun js2-test-indent (content)
5 (let ((s (replace-regexp-in-string "^ *|" "" content)))
7 (insert (replace-regexp-in-string "^ *" "" s))
9 (indent-region (point-min) (point-max))
10 (should (string= s (buffer-substring-no-properties
11 (point-min) (point)))))))
13 (defmacro* js2-deftest-indent (name content &key bind)
14 `(ert-deftest ,name ()
15 (let ,(append '((js2-basic-offset 2)
16 (js2-pretty-multiline-declarations t))
18 (js2-test-indent ,content))))
20 (put 'js2-deftest-indent 'lisp-indent-function 'defun)
22 (js2-deftest-indent no-multiline-decl-indent-after-semicolon
26 (js2-deftest-indent multiline-decl-indent-after-comma
30 (js2-deftest-indent no-multiline-decl-when-disabled
33 :bind ((js2-pretty-multiline-declarations nil)))
35 (js2-deftest-indent multiline-decl-with-continued-expr
39 (js2-deftest-indent multiline-decl-with-continued-expr-same-line
43 (js2-deftest-indent no-multiline-decl-with-operator-inside-string
44 "var foo = bar('/protocols/')
47 (js2-deftest-indent no-multiline-decl-implicit-semicolon
51 (js2-deftest-indent multiline-decl-sees-keyword-width
55 (js2-deftest-indent multiline-decl-second-arg-value-parenthesised
63 (js2-deftest-indent multiline-decl-first-arg-function-normal
64 "var foo = function() {
69 (js2-deftest-indent multiline-decl-first-arg-function-indent-all
70 "var foo = function() {
74 :bind ((js2-pretty-multiline-declarations 'all)))