/hg/rhino-tests: Two new tests added into JavaScriptsTest.
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Apr 9 11:29:21 UTC 2014
changeset 48afda73ee6e in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=48afda73ee6e
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Apr 09 13:30:07 2014 +0200
Two new tests added into JavaScriptsTest.
diffstat:
ChangeLog | 6 ++++++
src/org/RhinoTests/JavaScriptSnippets.java | 12 +++++++++++-
src/org/RhinoTests/JavaScriptsTest.java | 30 +++++++++++++++++++++++++++++-
3 files changed, 46 insertions(+), 2 deletions(-)
diffs (97 lines):
diff -r 2376dfe0bccd -r 48afda73ee6e ChangeLog
--- a/ChangeLog Tue Apr 08 09:57:54 2014 +0200
+++ b/ChangeLog Wed Apr 09 13:30:07 2014 +0200
@@ -1,3 +1,9 @@
+2014-04-09 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/JavaScriptSnippets.java:
+ * src/org/RhinoTests/JavaScriptsTest.java:
+ Two new tests added into JavaScriptsTest.
+
2014-04-08 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/SimpleScriptContextClassTest.java:
diff -r 2376dfe0bccd -r 48afda73ee6e src/org/RhinoTests/JavaScriptSnippets.java
--- a/src/org/RhinoTests/JavaScriptSnippets.java Tue Apr 08 09:57:54 2014 +0200
+++ b/src/org/RhinoTests/JavaScriptSnippets.java Wed Apr 09 13:30:07 2014 +0200
@@ -1,7 +1,7 @@
/*
Rhino test framework
- Copyright (C) 2012, 2013 Red Hat
+ Copyright (C) 2012, 2013, 2014 Red Hat
This file is part of IcedTea.
@@ -213,7 +213,17 @@
protected static final String HELLO_WORLD_3 = "println('\tHello' + ' ' + 'world!')";
/**
+ * Slightly modified hello world program.
+ */
+ protected static final String HELLO_WORLD_4 = "println('\tHello' + '\t' + 'world!')";
+
+ /**
* Statement containing unknown function.
*/
protected static final String UNKNOWN_FUNCTION = "_unknown_function_('\tHello world!')";
+
+ /**
+ * Statement containing unknown function.
+ */
+ protected static final String UNKNOWN_FUNCTION_2 = "_()";
}
diff -r 2376dfe0bccd -r 48afda73ee6e src/org/RhinoTests/JavaScriptsTest.java
--- a/src/org/RhinoTests/JavaScriptsTest.java Tue Apr 08 09:57:54 2014 +0200
+++ b/src/org/RhinoTests/JavaScriptsTest.java Wed Apr 09 13:30:07 2014 +0200
@@ -1,7 +1,7 @@
/*
Rhino test framework
- Copyright (C) 2011 Red Hat
+ Copyright (C) 2011, 2012, 2013, 2014 Red Hat
This file is part of IcedTea.
@@ -111,6 +111,16 @@
}
/**
+ * Test if it is possible to run script from a string.
+ *
+ * @throws ScriptException
+ * this exception is thrown when this test case failed.
+ */
+ protected void testRunSimpleScriptStoredInString4() throws ScriptException {
+ this.scriptEngine.eval(JavaScriptSnippets.HELLO_WORLD_4);
+ }
+
+ /**
* Test if exception is thrown when string contains script with unknown
* function.
*
@@ -129,6 +139,24 @@
}
/**
+ * Test if exception is thrown when string contains script with unknown
+ * function.
+ *
+ * @throws Exception
+ * this exception is thrown when this test case failed.
+ */
+ protected void testRunScriptContainingUnknownFunction2StoredInString() throws Exception {
+ try {
+ this.scriptEngine.eval(JavaScriptSnippets.UNKNOWN_FUNCTION_2);
+ }
+ catch (ScriptException e) {
+ System.out.println("\tException thrown as expected " + e.getMessage());
+ return; // ok, it's correct if this exception is thrown
+ }
+ throw new Exception("ScriptException not thrown as expected");
+ }
+
+ /**
* Test if exception is thrown when string contains script with bad
* parameters.
*
More information about the distro-pkg-dev
mailing list