Skip to content

Commit 2e7f83c

Browse files
committed
test moved to rhino
1 parent 13c7a85 commit 2e7f83c

File tree

1 file changed

+2
-64
lines changed

1 file changed

+2
-64
lines changed

src/test/java/org/htmlunit/corejs/ExceptionMessageTest.java

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
/**
1919
* Test that exception messages contain rich information.
20-
* Unit tests for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=604674">bug 604674</a>.
20+
*
2121
* @author Marc Guillemot
22+
* @author Ronald Brill
2223
*/
2324
public class ExceptionMessageTest {
2425

@@ -60,67 +61,4 @@ public Object run(final Context cx) {
6061

6162
Utils.runWithAllOptimizationLevels(action);
6263
}
63-
64-
/**
65-
* Unit test for bug 604674
66-
* https://bugzilla.mozilla.org/show_bug.cgi?id=604674
67-
*/
68-
@Test
69-
public void onlyGetterError() {
70-
onlyGetterError(Context.FEATURE_STRICT_MODE);
71-
}
72-
73-
private static void onlyGetterError(final int feature) {
74-
final ContextFactory cf = new ContextFactory() {
75-
@Override
76-
protected boolean hasFeature(Context cx, int featureIndex) {
77-
if (Context.FEATURE_STRICT_MODE == featureIndex) {
78-
return true;
79-
}
80-
return super.hasFeature(cx, featureIndex);
81-
}
82-
};
83-
84-
final String script = "o.readonlyProp = 123";
85-
86-
final ContextAction<Object> action = new ContextAction<Object>() {
87-
@Override
88-
public Object run(final Context cx) {
89-
try {
90-
Scriptable scope = cx.initSafeStandardObjects();
91-
final MyHostObject prototype = new MyHostObject();
92-
ScriptableObject.defineClass(scope, MyHostObject.class);
93-
final Method readMethod = MyHostObject.class.getMethod("jsxGet_x");
94-
prototype.defineProperty("readonlyProp", null, readMethod , null, ScriptableObject.EMPTY);
95-
96-
ScriptableObject.defineProperty(scope, "o", prototype, ScriptableObject.DONTENUM);
97-
98-
cx.evaluateString(scope, script, "test_script", 1, null);
99-
throw new RuntimeException("Should have failed!");
100-
}
101-
catch (final EcmaError e) {
102-
assertEquals("TypeError: Cannot set property [MyHostObject].readonlyProp that has only a getter to value '123'. (test_script#1)", e.getMessage());
103-
return null;
104-
}
105-
catch (final Exception e) {
106-
throw new RuntimeException(e);
107-
}
108-
}
109-
};
110-
111-
Utils.runWithAllOptimizationLevels(cf, action);
112-
}
113-
114-
public static class MyHostObject extends ScriptableObject {
115-
private int x;
116-
117-
@Override
118-
public String getClassName() {
119-
return getClass().getSimpleName();
120-
}
121-
122-
public int jsxGet_x() {
123-
return x;
124-
}
125-
}
12664
}

0 commit comments

Comments
 (0)