]> code.delx.au - gnu-emacs-elpa/blobdiff - tests/parser.el
Merge pull request #289 from dgreensp/fix-array-rest
[gnu-emacs-elpa] / tests / parser.el
index 5e19c5b2c0fcebc2563e8250e2ef7616d2a99f4c..90bbadd72000c8e5be653796c639644843b4d7d5 100644 (file)
@@ -126,6 +126,9 @@ the test."
 (js2-deftest-parse let-expression-statement
   "let (x = 42) x;")
 
+(js2-deftest-parse void
+  "void 0;")
+
 ;;; Callers of `js2-valid-prop-name-token'
 
 (js2-deftest-parse parse-property-access-when-not-keyword
@@ -158,6 +161,12 @@ the test."
 (js2-deftest-parse parse-for-of
   "for (var a of []) {\n}")
 
+(js2-deftest-parse of-can-be-name
+  "void of;")
+
+(js2-deftest-parse of-can-be-object-name
+  "of.z;")
+
 (js2-deftest-parse of-can-be-var-name
   "var of = 3;")
 
@@ -498,12 +507,24 @@ the test."
 
 ;;; 'async' and 'await' are contextual keywords
 
+(js2-deftest-parse async-can-be-name
+  "void async;")
+
+(js2-deftest-parse async-can-be-object-name
+  "async.z;")
+
 (js2-deftest-parse async-can-be-var-name
   "var async = 3;")
 
 (js2-deftest-parse async-can-be-function-name
   "function async() {\n}")
 
+(js2-deftest-parse await-can-be-name
+  "void await;")
+
+(js2-deftest-parse await-can-be-object-name
+  "await.z;")
+
 (js2-deftest-parse await-can-be-var-name
   "var await = 3;")
 
@@ -804,6 +825,13 @@ the test."
   (js2-mode)
   (should (not (equal nil js2-parsed-warnings))))
 
+(js2-deftest export-default-async-function-no-semicolon "export default async function foo() {}"
+  (js2-mode)
+  (should (equal nil js2-parsed-warnings)))
+(js2-deftest export-async-function-no-semicolon "export async function foo() {}"
+  (js2-mode)
+  (should (equal nil js2-parsed-warnings)))
+
 (js2-deftest-parse parse-export-rexport "export * from 'other/lib';")
 (js2-deftest-parse parse-export-export-named-list "export {foo, bar as bang};")
 (js2-deftest-parse parse-re-export-named-list "export {foo, bar as bang} from 'other/lib';")
@@ -813,6 +841,18 @@ the test."
 (js2-deftest-parse parse-export-generator-declaration "export default function* one() {\n}")
 (js2-deftest-parse parse-export-assignment-expression "export default a = b;")
 
+(js2-deftest-parse parse-export-function-declaration-no-semi
+  "export function f() {\n}")
+
+(js2-deftest-parse parse-export-class-declaration-no-semi
+  "export class C {\n}")
+
+(js2-deftest-parse parse-export-async-function-allow-await
+  "export async function f() {\n  await f();\n}")
+
+(js2-deftest-parse parse-export-default-async-function-allow-await
+  "export default async function f() {\n  await f();\n}")
+
 ;;; Strings
 
 (js2-deftest-parse string-literal