Skip to content

Commit c16a6f2

Browse files
committed
add testcase for mozilla#575 that proofs this already works
1 parent 5f6855f commit c16a6f2

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.mozilla.javascript.tests.es6;
2+
3+
import org.junit.Test;
4+
import org.mozilla.javascript.testutils.Utils;
5+
6+
/** Test for instanceof operator. */
7+
public class InstanceofTest {
8+
9+
@Test
10+
public void rightHandSideNotCallable() {
11+
String js =
12+
"try {\n"
13+
+ " throw SyntaxError();\n"
14+
+ "} catch (e) {\n"
15+
+ " var value = (e instanceof SyntaxError());\n"
16+
+ "}";
17+
18+
Utils.assertEcmaError(
19+
"TypeError: Target of ``instanceof`` must be callable or have ``[Symbol.hasInstance]`` method.",
20+
js);
21+
}
22+
}

0 commit comments

Comments
 (0)