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)
17 (inhibit-point-motion-hooks t))
19 (js2-test-indent ,content))))
21 (put 'js2-deftest-indent 'lisp-indent-function 'defun)
23 (js2-deftest-indent no-multiline-decl-indent-after-semicolon
27 (js2-deftest-indent multiline-decl-indent-after-comma
31 (js2-deftest-indent no-multiline-decl-when-disabled
34 :bind ((js2-pretty-multiline-declarations nil)))
36 (js2-deftest-indent multiline-decl-with-continued-expr
40 (js2-deftest-indent multiline-decl-with-continued-expr-same-line
44 (js2-deftest-indent no-multiline-decl-with-operator-inside-string
45 "var foo = bar('/protocols/')
48 (js2-deftest-indent no-multiline-decl-implicit-semicolon
52 (js2-deftest-indent multiline-decl-sees-keyword-width
56 (js2-deftest-indent multiline-decl-second-arg-value-parenthesised
64 (js2-deftest-indent multiline-decl-first-arg-function-normal
65 "var foo = function() {
70 (js2-deftest-indent multiline-decl-first-arg-function-indent-all
71 "var foo = function() {
75 :bind ((js2-pretty-multiline-declarations 'all)))