summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-01-26 23:45:13 +0100
committerLudovic Courtès <ludo@gnu.org>2011-01-26 23:47:31 +0100
commit90cfcf8fa7a0db1b6b84f2dba4f909c95e93c463 (patch)
tree47918980ff615e524dac9fe95b38265f9bb6596c
parent84816b3aaed73640e710a479ed08f72d90478f40 (diff)
downloadguile-90cfcf8fa7a0db1b6b84f2dba4f909c95e93c463.tar.gz
Add ECMAScript parser tests.
* test-suite/tests/ecmascript.test ("parser"): Add parser tests for the previous fixes.
-rw-r--r--test-suite/tests/ecmascript.test7
1 files changed, 6 insertions, 1 deletions
diff --git a/test-suite/tests/ecmascript.test b/test-suite/tests/ecmascript.test
index e96d383a4..8b5dd826f 100644
--- a/test-suite/tests/ecmascript.test
+++ b/test-suite/tests/ecmascript.test
@@ -40,6 +40,7 @@
(parse "true;" 'true)
(parse "2 + 2;" '(+ (number 2) (number 2)))
+ (parse "2\xa0+2;" '(+ (number 2) (number 2))) ; U+00A0 is whitespace
(parse "\"hello\";" '(string "hello"))
(parse "function square(x) { return x * x; }"
'(var (square (lambda (x) (return (* (ref x) (ref x)))))))
@@ -52,7 +53,11 @@
(parse "\"\\x12\";" ; Latin-1 escape in string literal
'(string "\x12"))
(parse "\"\\u1234\";" ; Unicode escape in string literal
- '(string "\u1234")))
+ '(string "\u1234"))
+ (parse "function foo(x) { }" ; empty function body
+ '(var (foo (lambda (x) (begin)))))
+ (parse ".123;" '(number 0.123))
+ (parse "0xff;" '(number 255)))
(define-syntax ecompile