summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js')
-rw-r--r--Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js
new file mode 100644
index 0000000..ce56cb9
--- /dev/null
+++ b/Source/JavaScriptCore/tests/mozilla/ecma_2/Statements/dowhile-005.js
@@ -0,0 +1,70 @@
+/**
+ * File Name: dowhile-005
+ * ECMA Section:
+ * Description: do...while statements
+ *
+ * Test a labeled do...while. Break out of the loop with no label
+ * should break out of the loop, but not out of the label.
+ *
+ * Currently causes an infinite loop in the monkey. Uncomment the
+ * print statement below and it works OK.
+ *
+ * Author: christine@netscape.com
+ * Date: 26 August 1998
+ */
+ var SECTION = "dowhile-005";
+ var VERSION = "ECMA_2";
+ var TITLE = "do...while with a labeled continue statement";
+ var BUGNUMBER = "316293";
+
+ startTest();
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+ var tc = 0;
+ var testcases = new Array();
+
+ NestedLabel();
+
+
+ test();
+
+ function NestedLabel() {
+ i = 0;
+ result1 = "pass";
+ result2 = "fail: did not hit code after inner loop";
+ result3 = "pass";
+
+ outer: {
+ do {
+ inner: {
+// print( i );
+ break inner;
+ result1 = "fail: did break out of inner label";
+ }
+ result2 = "pass";
+ break outer;
+ print (i);
+ } while ( i++ < 100 );
+
+ }
+
+ result3 = "fail: did not break out of outer label";
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "number of loop iterations",
+ 0,
+ i );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break out of inner loop",
+ "pass",
+ result1 );
+
+ testcases[tc++] = new TestCase(
+ SECTION,
+ "break out of outer loop",
+ "pass",
+ result2 );
+ } \ No newline at end of file