44 f(); 45 fail("expected error"); 46 } catch (e) { 47 var stack = e.nashornException.getStackTrace(); 48 var name = getFirstScriptFrame(stack).methodName; 49 if (name !== expected) { 50 fail("got " + name + ", expected " + expected); 51 } 52 } 53 } 54 55 testMethodName(function() { 56 return a.b.c; 57 }, "L:55"); 58 59 testMethodName(function() { throw new Error() }, "L:59"); 60 61 var f = (function() { 62 return function() { a.b.c; }; 63 })(); 64 testMethodName(f, "f$L:62"); 65 66 testMethodName((function() { 67 return function() { return a.b.c; }; 68 })(), "L:66$L:67"); | 44 f(); 45 fail("expected error"); 46 } catch (e) { 47 var stack = e.nashornException.getStackTrace(); 48 var name = getFirstScriptFrame(stack).methodName; 49 if (name !== expected) { 50 fail("got " + name + ", expected " + expected); 51 } 52 } 53 } 54 55 testMethodName(function() { 56 return a.b.c; 57 }, "L:55"); 58 59 testMethodName(function() { throw new Error() }, "L:59"); 60 61 var f = (function() { 62 return function() { a.b.c; }; 63 })(); 64 testMethodName(f, "f#L:62"); 65 66 testMethodName((function() { 67 return function() { return a.b.c; }; 68 })(), "L:66#L:67"); |