babel/test/fixtures/traceur/Classes/ClassNameInStack.js
2015-01-04 19:40:09 +11:00

30 lines
540 B
JavaScript

class MyClassName {
m() {
throw new Error();
}
}
try {
new MyClassName().m();
fail('Should have thrown');
} catch (ex) {
if (ex.stack)
assert.isTrue(String(ex.stack).indexOf('MyClassName') >= 0);
}
//////////////////////////////////////////////////////////////////////////////
class MySecondClass extends MyClassName{
m() {
throw new Error();
}
}
try {
new MySecondClass().m();
fail('Should have thrown');
} catch (ex) {
if (ex.stack)
assert.isTrue(String(ex.stack).indexOf('MySecondClass') >= 0);
}