aboutsummaryrefslogtreecommitdiffstats
path: root/test/ParserSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2010-11-16 13:57:41 -0800
committerIgor Minar2010-11-16 14:19:55 -0800
commitb2d63ac48bdc61b5a4afdd10b8485c0c1ab8cdca (patch)
tree0b798ba07d5b593dcc3e27964e81eb0542440d56 /test/ParserSpec.js
parent4af32de84a264e05eebfa6dbc09ce10fac1e1417 (diff)
downloadangular.js-b2d63ac48bdc61b5a4afdd10b8485c0c1ab8cdca.tar.bz2
Changed error handling so that better stack traces are displayed in the ng-errors
Diffstat (limited to 'test/ParserSpec.js')
-rw-r--r--test/ParserSpec.js16
1 files changed, 4 insertions, 12 deletions
diff --git a/test/ParserSpec.js b/test/ParserSpec.js
index f772e4a4..06cec2b3 100644
--- a/test/ParserSpec.js
+++ b/test/ParserSpec.js
@@ -158,11 +158,11 @@ describe('parser', function() {
it('should throws exception for invalid exponent', function() {
expect(function() {
lex("0.5E-");
- }).toThrow('Lexer found invalid exponential value "0.5E-"');
+ }).toThrow(new Error('Lexer Error: Invalid exponent at column 4 in expression [0.5E-].'));
expect(function() {
lex("0.5E-A");
- }).toThrow('Lexer found invalid exponential value "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() {
@@ -173,7 +173,7 @@ describe('parser', function() {
it('should throw error on invalid unicode', function() {
expect(function() {
lex("'\\u1''bla'");
- }).toThrow("Lexer Error: Invalid unicode escape [\\u1''b] starting at column '0' in expression ''\\u1''bla''.");
+ }).toThrow(new Error("Lexer Error: Invalid unicode escape [\\u1''b] at column 2 in expression ['\\u1''bla']."));
});
});
@@ -225,7 +225,7 @@ describe('parser', function() {
expect(function() {
scope.$eval("1|nonExistant");
- }).toThrow("Function 'nonExistant' at column '3' in '1|nonExistant' is not defined.");
+ }).toThrow(new Error("Parse Error: Token 'nonExistant' should be a function at column 3 of expression [1|nonExistant] starting at [nonExistant]."));
scope.$set('offset', 3);
expect(scope.$eval("'abcd'|upper._case")).toEqual("ABCD");
@@ -312,14 +312,6 @@ describe('parser', function() {
expect(scope.$eval(";;1;;")).toEqual(1);
});
- it('should evaluate throw', function() {
- scope.$set('e', 'abc');
-
- expect(function() {
- scope.$eval("throw e");
- }).toThrow('abc');
- });
-
it('should evaluate object methods in correct context (this)', function() {
var C = function () {
this.a = 123;