Debian Codegraph @

rhino/testsrc/doctests/util.js

raw symbols SCIP
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 function expectTypeError(code) { expectError(code, TypeError); }
6
7 function expectError(code, error) {
8 try {
9 code();
10 throw (code.toSource() + ' should have thrown a '+error);
11 } catch (e if e instanceof error) {
12 // all good
13 }
14 }