[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3f09ff3 09/45: Fix string literals in parser.el test harne
From: |
Dmitry Gutov |
Subject: |
[elpa] master 3f09ff3 09/45: Fix string literals in parser.el test harness. |
Date: |
Mon, 02 Feb 2015 03:18:35 +0000 |
branch: master
commit 3f09ff32e92e709214b0241083489a5d92e8f02f
Author: Stephen Hicks <address@hidden>
Commit: Stephen Hicks <address@hidden>
Fix string literals in parser.el test harness.
Previously all string literals in tests would fail, because they referred
to a temporary buffer that no longer exists. This fix works around this by
extending the life of the temporary input buffer.
---
tests/parser.el | 46 +++++++++++++++++++++++++++-------------------
1 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/tests/parser.el b/tests/parser.el
index 8d2cf70..d986ffc 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -36,28 +36,28 @@
(put 'js2-deftest 'lisp-indent-function 'defun)
(defun js2-test-string-to-ast (s)
- (ert-with-test-buffer (:name 'origin)
- (insert s)
- (js2-mode)
- (should (null js2-mode-buffer-dirty-p))
- js2-mode-ast))
+ (insert s)
+ (js2-mode)
+ (should (null js2-mode-buffer-dirty-p))
+ js2-mode-ast)
(defun* js2-test-parse-string (code-string &key syntax-error errors-count
reference)
- (let ((ast (js2-test-string-to-ast code-string)))
- (if syntax-error
- (let ((errors (js2-ast-root-errors ast)))
- (should (= (or errors-count 1) (length errors)))
- (destructuring-bind (_ pos len) (first errors)
- (should (string= syntax-error (substring code-string
- (1- pos) (+ pos len
-1))))))
- (should (= 0 (length (js2-ast-root-errors ast))))
- (ert-with-test-buffer (:name 'copy)
- (js2-print-tree ast)
- (skip-chars-backward " \t\n")
- (should (string= (or reference code-string)
- (buffer-substring-no-properties
- (point-min) (point))))))))
+ (ert-with-test-buffer (:name 'origin)
+ (let ((ast (js2-test-string-to-ast code-string)))
+ (if syntax-error
+ (let ((errors (js2-ast-root-errors ast)))
+ (should (= (or errors-count 1) (length errors)))
+ (destructuring-bind (_ pos len) (first errors)
+ (should (string= syntax-error (substring code-string
+ (1- pos) (+ pos len
-1))))))
+ (should (= 0 (length (js2-ast-root-errors ast))))
+ (ert-with-test-buffer (:name 'copy)
+ (js2-print-tree ast)
+ (skip-chars-backward " \t\n")
+ (should (string= (or reference code-string)
+ (buffer-substring-no-properties
+ (point-min) (point)))))))))
(defmacro* js2-deftest-parse (name code-string &key bind syntax-error
errors-count
reference)
@@ -332,6 +332,14 @@ the test."
(js2-deftest-parse octal-number-broken "0o812;"
:syntax-error "0o8" :errors-count 2)
+;;; Strings
+
+(js2-deftest-parse string-literal
+ "var x = 'y';")
+
+(js2-deftest-parse object-get-string-literal
+ "var x = {y: 5};\nvar z = x[\"y\"];")
+
;;; Classes
(js2-deftest-parse parse-harmony-class-statement
- [elpa] master c79d426 06/45: Support ES6 class statements/expressions., (continued)
- [elpa] master c79d426 06/45: Support ES6 class statements/expressions., Dmitry Gutov, 2015/02/01
- [elpa] master 2b0f5ba 08/45: Support parsing the ES6 'super' keyword., Dmitry Gutov, 2015/02/01
- [elpa] master dd344ff 01/45: Support short-hand object literals {foo, bar} everywhere., Dmitry Gutov, 2015/02/01
- [elpa] master b1f7e6c 11/45: Simplify parsing of destructuring literals, Dmitry Gutov, 2015/02/01
- [elpa] master 68b4abd 02/45: Add ES6 class externs, Dmitry Gutov, 2015/02/01
- [elpa] master ee17084 13/45: js2-parse-plain-property: Disallow numbers as abbreviated props, Dmitry Gutov, 2015/02/01
- [elpa] master b19ea52 12/45: js2-parse-named-prop: Highlight externals in abbreviated props, Dmitry Gutov, 2015/02/01
- [elpa] master 31c49e0 14/45: js2-imenu-extension-styles: Turn into defvar, Dmitry Gutov, 2015/02/01
- [elpa] master 9b77d64 15/45: Implement template strings, ignoring substitutions, Dmitry Gutov, 2015/02/01
- [elpa] master 7b3d590 17/45: No need to explicitly apply face to string nodes, Dmitry Gutov, 2015/02/01
- [elpa] master 3f09ff3 09/45: Fix string literals in parser.el test harness.,
Dmitry Gutov <=
- [elpa] master d0c6bf3 18/45: Comment the new token types, Dmitry Gutov, 2015/02/01
- [elpa] master 9525eb3 10/45: Merge branch 'master' of github.com:shicks/js2-mode into shicks-master, Dmitry Gutov, 2015/02/01
- [elpa] master c910d1b 19/45: Parse tagged templates, Dmitry Gutov, 2015/02/01
- [elpa] master 8df508e 16/45: Handle template substitutions, Dmitry Gutov, 2015/02/01
- [elpa] master 92063fe 22/45: Fix js2-visit-tagged-template, Dmitry Gutov, 2015/02/01
- [elpa] master 94c2ec9 20/45: Drop `js2-allow-keywords-as-property-names' and `js2-valid-prop-name-token', Dmitry Gutov, 2015/02/01
- [elpa] master ab82544 23/45: Do not declare fn expression's name in the enclosing scope, Dmitry Gutov, 2015/02/01
- [elpa] master e6dc986 24/45: Limit the scope of `with-silent-modifications', Dmitry Gutov, 2015/02/01
- [elpa] master 6a4e84b 26/45: js2-parse-for: Reword docstring and comments, Dmitry Gutov, 2015/02/01
- [elpa] master 8088e75 21/45: Add js2-language-version check for template literals, Dmitry Gutov, 2015/02/01