Mercurial > hg > rhino-tests
changeset 320:cc40267835dc draft
Enhancement of the test CompiledScriptClassTest.
author | Pavel Tisnovsky <ptisnovs@redhat.com> |
---|---|
date | Fri, 14 Feb 2014 14:09:52 +0100 |
parents | 087d4f0b3133 |
children | e97b81e2f125 |
files | ChangeLog src/org/RhinoTests/CompiledScriptClassTest.java |
diffstat | 2 files changed, 78 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Feb 13 09:35:58 2014 +0100 +++ b/ChangeLog Fri Feb 14 14:09:52 2014 +0100 @@ -1,3 +1,8 @@ +2014-02-14 Pavel Tisnovsky <ptisnovs@redhat.com> + + * src/org/RhinoTests/CompiledScriptClassTest.java: + Enhancement of the test CompiledScriptClassTest. + 2014-02-13 Pavel Tisnovsky <ptisnovs@redhat.com> * src/org/RhinoTests/InvocableClassTest.java:
--- a/src/org/RhinoTests/CompiledScriptClassTest.java Thu Feb 13 09:35:58 2014 +0100 +++ b/src/org/RhinoTests/CompiledScriptClassTest.java Fri Feb 14 14:09:52 2014 +0100 @@ -1,7 +1,7 @@ /* Rhino test framework - Copyright (C) 2011, 2012, 2013 Red Hat + Copyright (C) 2011, 2012, 2013, 2014 Red Hat This file is part of IcedTea. @@ -1675,6 +1675,14 @@ } try { + this.compiledScriptClass.cast(Character.valueOf('a')); + throw new AssertionError("Class.cast(Character.valueOf('a')) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { this.compiledScriptClass.cast(Byte.valueOf((byte)42)); throw new AssertionError("Class.cast(Byte.valueOf((byte)42)) does not throw any exception"); } @@ -1731,6 +1739,14 @@ } try { + this.compiledScriptClass.cast(new Throwable("xyzzy")); + throw new AssertionError("Class.cast(new Throwable(\"xyzzy\")) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { this.compiledScriptClass.cast(new RuntimeException()); throw new AssertionError("Class.cast(new RuntimeException()) does not throw any exception"); } @@ -1739,6 +1755,14 @@ } try { + this.compiledScriptClass.cast(new RuntimeException("xyzzy")); + throw new AssertionError("Class.cast(new RuntimeException(\"xyzzy\")) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { this.compiledScriptClass.cast(new Error()); throw new AssertionError("Class.cast(new Error()) does not throw any exception"); } @@ -1747,6 +1771,22 @@ } try { + this.compiledScriptClass.cast(new Error("xyzzy")); + throw new AssertionError("Class.cast(new Error(\"xyzzy\")) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.compiledScriptClass.cast(new java.io.File("xyzzy")); + throw new AssertionError("Class.cast(new java.io.File(\"xyzzy\")) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { this.compiledScriptClass.cast(new java.lang.String()); throw new AssertionError("Class.cast(new java.lang.String()) does not throw any exception"); } @@ -1795,6 +1835,30 @@ } try { + this.compiledScriptClass.cast(new java.awt.Label()); + throw new AssertionError("Class.cast(new java.awt.Label()) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.compiledScriptClass.cast(new java.awt.Label(new String())); + throw new AssertionError("Class.cast(new java.awt.Label(new String())) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { + this.compiledScriptClass.cast(new java.awt.Label("xyzzy")); + throw new AssertionError("Class.cast(new java.awt.Label(\"xyzzy\")) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { this.compiledScriptClass.cast(new javax.swing.JLabel()); throw new AssertionError("Class.cast(new javax.swing.JLabel()) does not throw any exception"); } @@ -1811,6 +1875,14 @@ } try { + this.compiledScriptClass.cast(new javax.swing.JLabel("xyzzy")); + throw new AssertionError("Class.cast(new javax.swing.JLabel(\"xyzzy\")) does not throw any exception"); + } + catch (Exception e) { + // expected exception + } + + try { this.compiledScriptClass.cast(new javax.swing.JPanel()); throw new AssertionError("Class.cast(new javax.swing.JPanel()) does not throw any exception"); }