(js2-deftest-parse named-function-expression\r
"a = function b() {};")\r
\r
-;;; Callers of `js2-valid-prop-name-token'.\r
+;;; Callers of `js2-valid-prop-name-token'\r
\r
(js2-deftest-parse parse-property-access-when-not-keyword\r
"A.foo = 3;")\r
"a = {in: 1};"\r
:bind ((js2-allow-keywords-as-property-names t)))\r
\r
-;;; 'of' contextual keyword.\r
+;;; 'of' contextual keyword\r
\r
(js2-deftest-parse parse-array-comp-loop-with-of\r
"[a for (a of [])];")\r
(js2-deftest-parse of-can-be-function-name\r
"function of() {\n}")\r
\r
-;;; Destructuring binding.\r
+;;; Destructuring binding\r
\r
(js2-deftest-parse destruct-in-declaration\r
"var {a, b} = {a: 1, b: 2};")\r
(js2-deftest-parse destruct-in-catch-clause\r
"try {\n} catch ({a, b}) {\n a + b;\n}")\r
\r
-;;; Function parameters.\r
+;;; Function parameters\r
\r
(js2-deftest-parse function-with-default-parameters\r
"function foo(a = 1, b = a + 1) {\n}")\r
(js2-deftest-parse function-with-rest-after-default-parameter\r
"function foo(a = 1, ...rest) {\n}")\r
\r
-;;; Arrow functions.\r
+;;; Arrow functions\r
\r
(js2-deftest-parse arrow-function-with-empty-args-and-no-curlies\r
"() => false;" :reference "() => {false};")\r
(js2-deftest-parse parenless-arrow-function-prohibits-destructuring\r
"[a, b] => {a + b;};" :syntax-error "]" :errors-count 5)\r
\r
-;;; Automatic semicolon insertion.\r
+;;; Automatic semicolon insertion\r
\r
(js2-deftest-parse no-auto-semi-insertion-after-if\r
"if (true) {\n}")\r
(should (eq js2-NUMBER (js2-next-token)))\r
(should (eq 1 (js2-token-number\r
(js2-current-token))))))\r
+\r
+;;; Error handling\r
+\r
+(js2-deftest for-node-with-error-len "for "\r
+ (js2-mode)\r
+ (let ((node (js2-node-at-point (point-min))))\r
+ (should (= (js2-node-len (js2-node-parent node)) 4))))\r
+\r
+(js2-deftest function-without-parens-error "function b {}"\r
+ ;; Should finish the parse.\r
+ (js2-mode))\r