summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Class/shell.js
blob: 7fb703b983c9ecd331b186c2f84ac60c271f1836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// NOTE: This only turns on 1.8.5 in shell builds.  The browser requires the
//       futzing in js/src/tests/browser.js (which only turns on 1.8, the most
//       the browser supports).
if (typeof version != 'undefined')
  version(185);

function assertThrownErrorContains(thunk, substr) {
    try {
        thunk();
    } catch (e) {
        if (e.message.indexOf(substr) !== -1)
            return;
        throw new Error("Expected error containing " + substr + ", got " + e);
    }
    throw new Error("Expected error containing " + substr + ", no exception thrown");
}