aboutsummaryrefslogtreecommitdiffstats
path: root/test/ParserSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/ParserSpec.js')
-rw-r--r--test/ParserSpec.js22
1 files changed, 9 insertions, 13 deletions
diff --git a/test/ParserSpec.js b/test/ParserSpec.js
index c237aa40..71208783 100644
--- a/test/ParserSpec.js
+++ b/test/ParserSpec.js
@@ -82,9 +82,15 @@ describe('parser', function() {
expect(tokens.length).toEqual(1);
expect(tokens[0].string).toEqual('\u00a0');
});
+
+ it('should error when non terminated string', function(){
+ expect(function(){
+ lex('ignore "text');
+ }).toThrow(new Error('Lexer Error: Unterminated string at column 7 in expression [ignore "text].'));
+ });
it('should ignore whitespace', function() {
- var tokens = lex("a \t \n \r b");
+ var tokens = lex("a \t \n \r \u00A0 b");
expect(tokens[0].text).toEqual('a');
expect(tokens[1].text).toEqual('b');
});
@@ -130,16 +136,6 @@ describe('parser', function() {
expect(tokens[0].text).toEqual(0.5E+10);
});
- it('should throws exception for invalid exponent', function() {
- expect(function() {
- lex("0.5E-");
- }).toThrow(new Error('Lexer Error: Invalid exponent at column 4 in expression [0.5E-].'));
-
- expect(function() {
- lex("0.5E-A");
- }).toThrow(new Error('Lexer Error: Invalid exponent at column 4 in expression [0.5E-A].'));
- });
-
it('should tokenize number starting with a dot', function() {
var tokens = lex(".5");
expect(tokens[0].text).toEqual(0.5);
@@ -147,8 +143,8 @@ describe('parser', function() {
it('should throw error on invalid unicode', function() {
expect(function() {
- lex("'\\u1''bla'");
- }).toThrow(new Error("Lexer Error: Invalid unicode escape [\\u1''b] at column 2 in expression ['\\u1''bla']."));
+ lex("'\\u1xbla'");
+ }).toThrow(new Error("Lexer Error: Invalid unicode escape [\\u1xbl] at columns 0-9 ['\\u1xbla'] in expression ['\\u1xbla']."));
});
});