[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master de5b31c 085/110: Fix the tests broken in the previous comm
From: |
Dmitry Gutov |
Subject: |
[elpa] master de5b31c 085/110: Fix the tests broken in the previous commit |
Date: |
Thu, 23 Jun 2016 01:13:02 +0000 (UTC) |
branch: master
commit de5b31c5cf0af070138959796c7af9192e098095
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Fix the tests broken in the previous commit
---
js2-mode.el | 1 +
tests/parser.el | 56 +++++++++++++++++++++++++++++--------------------------
2 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index 167851e..5b3f177 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7259,6 +7259,7 @@ are ignored."
js2-additional-externs)))
(defun js2-get-jslint-globals ()
+ (js2-reparse)
(cl-loop for node in (js2-ast-root-comments js2-mode-ast)
when (and (eq 'block (js2-comment-node-format node))
(save-excursion
diff --git a/tests/parser.el b/tests/parser.el
index 90bbadd..c672c66 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -35,9 +35,13 @@
,@body)
(fundamental-mode)))))
+(defun js2-mode--and-parse ()
+ (js2-mode)
+ (js2-reparse))
+
(defun js2-test-string-to-ast (s)
(insert s)
- (js2-mode)
+ (js2-mode--and-parse)
(should (null js2-mode-buffer-dirty-p))
js2-mode-ast)
@@ -206,12 +210,12 @@ the test."
"\"use strict\";\nvar {a=1,a=2} = {};" :syntax-error "a" :errors-count 1)
(js2-deftest destruct-name-conflict-is-warning-in-array "\"use strict\";\nvar
[a=1,a=2] = [];"
- (js2-mode)
+ (js2-mode--and-parse)
(should (equal '("msg.var.redecl" "a")
(caar js2-parsed-warnings))))
(js2-deftest initializer-outside-destruct-is-error "({a=1});"
- (js2-mode)
+ (js2-mode--and-parse)
(should (equal "msg.init.no.destruct"
(car (caar js2-parsed-errors)))))
@@ -227,7 +231,7 @@ the test."
"var x = {f(y) { return y;\n}};")
(js2-deftest object-literal-method-own-name-in-scope "({f(){f();}});"
- (js2-mode)
+ (js2-mode--and-parse)
(should (equal '("msg.undeclared.variable" "f")
(caar js2-parsed-warnings))))
@@ -255,11 +259,11 @@ the test."
;;; Function definition
(js2-deftest function-redeclaring-var "var gen = 3; function gen() {};"
- (js2-mode)
+ (js2-mode--and-parse)
(should (= (length (js2-ast-root-warnings js2-mode-ast)) 1)))
(js2-deftest function-expression-var-same-name "var gen = function gen() {};"
- (js2-mode)
+ (js2-mode--and-parse)
(should (null (js2-ast-root-warnings js2-mode-ast))))
;;; Function parameters
@@ -415,7 +419,7 @@ the test."
(js2-deftest no-label-node-inside-expr "x = y:"
(let (js2-parse-interruptable-p)
- (js2-mode))
+ (js2-mode--and-parse))
(let ((assignment (js2-expr-stmt-node-expr (car (js2-scope-kids
js2-mode-ast)))))
(should (js2-name-node-p (js2-assign-node-right assignment)))))
@@ -816,20 +820,20 @@ the test."
(should (js2-export-node-default export-node))))
(js2-deftest export-function-no-semicolon "export default function foo() {}"
- (js2-mode)
+ (js2-mode--and-parse)
(should (equal nil js2-parsed-warnings)))
(js2-deftest export-default-function-no-semicolon "export function foo() {}"
- (js2-mode)
+ (js2-mode--and-parse)
(should (equal nil js2-parsed-warnings)))
(js2-deftest export-anything-else-does-require-a-semicolon "export var obj =
{}"
- (js2-mode)
+ (js2-mode--and-parse)
(should (not (equal nil js2-parsed-warnings))))
(js2-deftest export-default-async-function-no-semicolon "export default async
function foo() {}"
- (js2-mode)
+ (js2-mode--and-parse)
(should (equal nil js2-parsed-warnings)))
(js2-deftest export-async-function-no-semicolon "export async function foo()
{}"
- (js2-mode)
+ (js2-mode--and-parse)
(should (equal nil js2-parsed-warnings)))
(js2-deftest-parse parse-export-rexport "export * from 'other/lib';")
@@ -918,7 +922,7 @@ the test."
;;; Scopes
(js2-deftest ast-symbol-table-includes-fn-node "function foo() {}"
- (js2-mode)
+ (js2-mode--and-parse)
(let ((entry (js2-scope-get-symbol js2-mode-ast 'foo)))
(should (= (js2-symbol-decl-type entry) js2-FUNCTION))
(should (equal (js2-symbol-name entry) "foo"))
@@ -928,7 +932,7 @@ the test."
function bar() {}
var x;
}"
- (js2-mode)
+ (js2-mode--and-parse)
(let* ((scope (js2-node-at-point (point-min)))
(fn-entry (js2-scope-get-symbol scope 'bar))
(var-entry (js2-scope-get-symbol scope 'x)))
@@ -946,36 +950,36 @@ the test."
(should (funcall predicate (js2-get-defining-scope scope variable)))))
(js2-deftest for-node-is-declaration-scope "for (let i = 0; i; ++i) {};"
- (js2-mode)
+ (js2-mode--and-parse)
(js2-test-scope-of-nth-variable-satisifies-predicate "i" 0 #'js2-for-node-p))
(js2-deftest const-scope-sloppy-script "{const a;} a;"
- (js2-mode)
+ (js2-mode--and-parse)
(js2-test-scope-of-nth-variable-satisifies-predicate "a" 0
#'js2-script-node-p)
(js2-test-scope-of-nth-variable-satisifies-predicate "a" 1
#'js2-script-node-p))
(js2-deftest const-scope-strict-script "'use strict'; { const a; } a;"
- (js2-mode)
+ (js2-mode--and-parse)
(js2-test-scope-of-nth-variable-satisifies-predicate "a" 0
#'js2-block-node-p)
(js2-test-scope-of-nth-variable-satisifies-predicate "a" 1 #'null))
(js2-deftest const-scope-sloppy-function "function f() { { const a; } a; }"
- (js2-mode)
+ (js2-mode--and-parse)
(js2-test-scope-of-nth-variable-satisifies-predicate "a" 0
#'js2-function-node-p)
(js2-test-scope-of-nth-variable-satisifies-predicate "a" 1
#'js2-function-node-p))
(js2-deftest const-scope-strict-function "function f() { 'use strict'; { const
a; } a; }"
- (js2-mode)
+ (js2-mode--and-parse)
(js2-test-scope-of-nth-variable-satisifies-predicate "a" 0
#'js2-block-node-p)
(js2-test-scope-of-nth-variable-satisifies-predicate "a" 1 #'null))
(js2-deftest array-comp-is-result-scope "[x * 2 for (x in y)];"
- (js2-mode)
+ (js2-mode--and-parse)
(js2-test-scope-of-nth-variable-satisifies-predicate "x" 0
#'js2-comp-loop-node-p))
(js2-deftest array-comp-has-parent-scope
"var a,b=[for (i of [[1,2]]) for (j of i) j * a];"
- (js2-mode)
+ (js2-mode--and-parse)
(search-forward "for")
(forward-char -3)
(let ((node (js2-node-at-point)))
@@ -1045,23 +1049,23 @@ the test."
;;; Error handling
(js2-deftest for-node-with-error-len "for "
- (js2-mode)
+ (js2-mode--and-parse)
(let ((node (js2-node-at-point (point-min))))
(should (= (js2-node-len (js2-node-parent node)) 4))))
(js2-deftest function-without-parens-error "function b {}"
;; Should finish the parse.
- (js2-mode))
+ (js2-mode--and-parse))
;;; Comments
(js2-deftest comment-node-length "//"
- (js2-mode)
+ (js2-mode--and-parse)
(let ((node (js2-node-at-point (point-min))))
(should (= (js2-node-len node) 2))))
(js2-deftest comment-node-length-newline "//\n"
- (js2-mode)
+ (js2-mode--and-parse)
(let ((node (js2-node-at-point (point-min))))
(should (= (js2-node-len node) 3))))
@@ -1100,7 +1104,7 @@ the test."
(insert ,buffer-contents))
(unwind-protect
(progn
- (js2-mode)
+ (js2-mode--and-parse)
(should (equal ,summary (js2--variables-summary
(js2--classify-variables)))))
(fundamental-mode)))))
- [elpa] master dbf4fe9 038/110: Adapt async/await changes to latest master, (continued)
- [elpa] master dbf4fe9 038/110: Adapt async/await changes to latest master, Dmitry Gutov, 2016/06/22
- [elpa] master 7fe7165 053/110: Fix array destructuring including triple-dot, Dmitry Gutov, 2016/06/22
- [elpa] master d1bf11f 068/110: Fix void parsing, Dmitry Gutov, 2016/06/22
- [elpa] master 7b430a3 079/110: Merge pull request #308 from zmwangx/jsdoc-callback-func-method, Dmitry Gutov, 2016/06/22
- [elpa] master c988876 086/110: Fix the straggler, Dmitry Gutov, 2016/06/22
- [elpa] master 6399bec 001/110: Support ES(7) async/await syntax; Closes #185, Dmitry Gutov, 2016/06/22
- [elpa] master fa0aa09 060/110: Merge pull request #294 from lunaryorn/patch-1, Dmitry Gutov, 2016/06/22
- [elpa] master ec7932d 047/110: Merge pull request #283 from XeCycle/master-with-async, Dmitry Gutov, 2016/06/22
- [elpa] master e44d9e1 088/110: Merge pull request #325 from phst/all-tests, Dmitry Gutov, 2016/06/22
- [elpa] master 812df51 091/110: Merge pull request #326 from phst/compiler-warning-25, Dmitry Gutov, 2016/06/22
- [elpa] master de5b31c 085/110: Fix the tests broken in the previous commit,
Dmitry Gutov <=
- [elpa] master f130121 095/110: Merge pull request #328 from XeCycle/iname-color, Dmitry Gutov, 2016/06/22
- [elpa] master 9586f45 096/110: Add :warnings-count keyword argument, Dmitry Gutov, 2016/06/22
- [elpa] master e5e4fa4 105/110: Add js2-mode-assume-strict custom variable, Dmitry Gutov, 2016/06/22
- [elpa] master bb0acf5 106/110: Merge pull request #342 from shicks/strict, Dmitry Gutov, 2016/06/22
- [elpa] master 173d1c8 101/110: Merge pull request #332 from bolivier/master, Dmitry Gutov, 2016/06/22
- [elpa] master c162f35 092/110: Colorize contextual keywords as & from in import & export, Dmitry Gutov, 2016/06/22
- [elpa] master 66fe8de 107/110: js2-define-symbol: Treat const same as let, Dmitry Gutov, 2016/06/22
- [elpa] master 04f3d4b 110/110: Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode, Dmitry Gutov, 2016/06/22