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