diff options
Diffstat (limited to 'js/src/jit-test/tests/class/bug1473272-default-constructors.js')
-rw-r--r-- | js/src/jit-test/tests/class/bug1473272-default-constructors.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/class/bug1473272-default-constructors.js b/js/src/jit-test/tests/class/bug1473272-default-constructors.js new file mode 100644 index 0000000000..e9bd5c1889 --- /dev/null +++ b/js/src/jit-test/tests/class/bug1473272-default-constructors.js @@ -0,0 +1,24 @@ +// Test the source location info in a derived-class default constructor. + +function W() { test(); } +class Z extends W {} // line 4 +class Y extends Z {} // line 5 + +class X extends Y {} // line 7 + +function test() { + for (let frame of new Error().stack.split('\n')) { + function lineNumber(frame) { + return +frame.match(/(\d+):\d+$/)[1]; + } + + if (frame.startsWith("Z@")) + assertEq(lineNumber(frame), 4); + if (frame.startsWith("Y@")) + assertEq(lineNumber(frame), 5); + if (frame.startsWith("X@")) + assertEq(lineNumber(frame), 7); + } +} + +new X; |