@@ -198,7 +198,7 @@ describe('StackTraceGPS', function() {
198198 }
199199 } ) ;
200200
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 ) {
202202 var source = 'if (a) { foo(); } else if (b) { bar(); }' ;
203203 jasmine . Ajax . stubRequest ( 'http://localhost:9999/file.js' ) . andReturn ( { responseText : source } ) ;
204204 var originalStackFrame = new StackFrame ( { functionName : '@test@' , args : [ ] , fileName : 'http://localhost:9999/file.js' , lineNumber : 1 , columnNumber : 0 } ) ;
@@ -210,6 +210,18 @@ describe('StackTraceGPS', function() {
210210 }
211211 } ) ;
212212
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+
213225 it ( 'ignores commented out function definitions' , function ( done ) {
214226 var source = 'var foo = function() {};\n//function bar() {}\nvar baz = eval("XXX")' ;
215227 jasmine . Ajax . stubRequest ( 'http://localhost:9999/file.js' ) . andReturn ( { responseText : source } ) ;
0 commit comments