@@ -198,7 +198,7 @@ describe('StackTraceGPS', function() {
198
198
}
199
199
} ) ;
200
200
201
- it ( 'ignores special case involving class functions ' , function ( done ) {
201
+ it ( 'ignores special case interpreting control structures as the function parameter list ' , function ( done ) {
202
202
var source = 'if (a) { foo(); } else if (b) { bar(); }' ;
203
203
jasmine . Ajax . stubRequest ( 'http://localhost:9999/file.js' ) . andReturn ( { responseText : source } ) ;
204
204
var originalStackFrame = new StackFrame ( { functionName : '@test@' , args : [ ] , fileName : 'http://localhost:9999/file.js' , lineNumber : 1 , columnNumber : 0 } ) ;
@@ -210,6 +210,18 @@ describe('StackTraceGPS', function() {
210
210
}
211
211
} ) ;
212
212
213
+ it ( 'ignores special case interpreting control structures as the function name' , function ( done ) {
214
+ var source = 'functionCall()\nif (condition) {' ;
215
+ jasmine . Ajax . stubRequest ( 'http://localhost:9999/file.js' ) . andReturn ( { responseText : source } ) ;
216
+ var originalStackFrame = new StackFrame ( { functionName : '@test@' , args : [ ] , fileName : 'http://localhost:9999/file.js' , lineNumber : 2 , columnNumber : 0 } ) ;
217
+ new StackTraceGPS ( ) . findFunctionName ( originalStackFrame ) . then ( callback , done . fail ) ;
218
+
219
+ function callback ( stackframe ) {
220
+ expect ( stackframe ) . toEqual ( originalStackFrame ) ;
221
+ done ( ) ;
222
+ }
223
+ } ) ;
224
+
213
225
it ( 'ignores commented out function definitions' , function ( done ) {
214
226
var source = 'var foo = function() {};\n//function bar() {}\nvar baz = eval("XXX")' ;
215
227
jasmine . Ajax . stubRequest ( 'http://localhost:9999/file.js' ) . andReturn ( { responseText : source } ) ;
0 commit comments