示例#1
0
 @Test
 public void apps_simplecalc() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {"test/apps/simplecalc/math2.html"};
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#2
0
 @Test
 public void apps_minesweeper() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {"test/apps/minesweeper/minesweeper.html"};
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#3
0
 @Test
 public void apps_projavascript_sun() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {"test/apps/projavascript/sun/08-sun.html"};
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#4
0
 @Test
 public void apps_paint() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {"test/apps/paint/index.html", "test/apps/paint/paint.js"};
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#5
0
 @Test
 public void apps_mceditor_full() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {"test/apps/mceditor/full.html", "test/apps/mceditor/tiny_mce_src.js"};
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#6
0
 @Test
 public void apps_jscrypto_encrypt_from_form() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {"test/apps/jscrypto/encrypt_from_form.html", "test/apps/jscrypto/jscrypto.js"};
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#7
0
 @Test
 public void apps_solitaire() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {"test/apps/solitaire/spider.html"};
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#8
0
 @Test
 public void apps_samegame() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {
     "test/apps/samegame/index.html", "test/apps/samegame/header.js", "test/apps/samegame/main.js"
   };
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#9
0
 @Test
 public void exceptionInBody() {
   Misc.init();
   Misc.runSource(
       "var v = true;",
       "for(var p in {'a': 'a'}){",
       "   v = false;",
       "   FAIL;",
       "}",
       "TAJS_assert(v);");
 }
示例#10
0
 @Test
 public void noProperties() {
   Misc.init();
   Misc.runSource(
       "",
       "var x;",
       "for(var p in {}){",
       "}",
       "TAJS_assert(x, 'isNotUndef', false);",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#11
0
 @Test
 public void apps_projavascript_gallery() throws Exception {
   Misc.init();
   Misc.captureSystemOutput();
   String[] args = {
     "test/apps/projavascript/gallery/index.html",
     "test/apps/projavascript/gallery/library.js",
     "test/apps/projavascript/gallery/gallery.js"
   };
   Misc.run(args);
   Misc.checkSystemOutput();
 }
示例#12
0
 @Test
 public void regression_NullPointerException() {
   Misc.init();
   Misc.runSource(
       "",
       "function merge(root){",
       "  for ( var i = 0; i < arguments.length; i++ )",
       "    for ( var key in arguments[i] )",
       "      root[key] = arguments[i][key];",
       "}",
       "merge({p: 'p'}, {q: 'q'});");
 }
示例#13
0
 @Test
 public void catching() {
   Misc.init();
   Misc.runSource(
       "",
       "try {",
       "   for(var p in {a: 'a'}){",
       "       throw 42;",
       "   }",
       "}catch(e){",
       "}",
       "");
 }
示例#14
0
 @Test
 public void twoPropertiesConflict1() {
   Misc.init();
   Misc.runSource(
       "",
       "var x = '';",
       "for(var p in {a: 'a', b: 'b'}){",
       "   x += p;",
       "}",
       "TAJS_assert(x, 'isMaybeStrIdentifierParts');",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#15
0
 @Test
 public void concatenateIdentifierString() {
   // should not crash
   Misc.init();
   Misc.runSource(
       "",
       "var s = 'a';",
       "for(var p in {b: 'b', c: 'c'}){",
       "   s += p;",
       "}",
       "TAJS_assert(s, 'isMaybeStrIdentifierParts');", // optimal precision would give
                                                       // StrIdentifier
       "");
 }
示例#16
0
 @Test
 public void twoPropertiesConflict3() {
   Misc.init();
   Misc.runSource(
       "",
       "var x = 0;",
       "var o = {a: 1, b: 2};",
       "for(var p in o){",
       "   x += o[p];",
       "}",
       "TAJS_assert(x, 'isMaybeNumUInt');",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#17
0
 @Test
 public void readingPropertiesFromOutSideLoop_bug() {
   Misc.init();
   Misc.runSource(
       "",
       "var o = { u: Math.random() };",
       "for(var p in {a: 'a'}){",
       "   if(o.u){",
       "       break;",
       "   }",
       "}",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#18
0
 @Test
 public void oneProperty() {
   Misc.init();
   Misc.runSource(
       "",
       "var x;",
       "for(var p in {a: 'a'}){",
       "   x = p;",
       "}",
       "TAJS_assert(x, 'isMaybeSingleStr');",
       "TAJS_assert(x, 'isMaybeUndef');",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#19
0
 @Test
 public void returningValue() {
   Misc.init();
   Misc.runSource(
       "",
       "var v = (function(){",
       "   for(var p in {a: 'a'}){",
       "       return 42;",
       "   }",
       "})();",
       "TAJS_assert(v, 'isMaybeSingleNum');",
       "TAJS_assert(v, 'isMaybeUndef');",
       "");
 }
示例#20
0
 @Test
 public void throwingAndCatchingValue() {
   Misc.init();
   Misc.runSource(
       "",
       "try {",
       "   for(var p in {a: 'a'}){",
       "       throw 42;",
       "   }",
       "}catch(e){",
       "   TAJS_assert(e, 'isMaybeSingleNum');",
       "   TAJS_assert(e, 'isMaybeUndef', false);",
       "}",
       "");
 }
示例#21
0
 @Test
 public void twoProperties() {
   Misc.init();
   Misc.runSource(
       "",
       "var x;",
       "for(var p in {a: 'a', b: 'b'}){",
       "   x = p;",
       "}",
       "TAJS_assert(x, 'isMaybeSingleStr', false);",
       "TAJS_assert(x, 'isMaybeStrIdentifier');",
       "TAJS_assert(x, 'isMaybeUndef');",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#22
0
 @Test
 public void arrayProperties() {
   Misc.init();
   Misc.runSource(
       "",
       "var x;",
       "for(var p in ['a', 'b']){",
       "   x = p;",
       "}",
       "TAJS_assert(x, 'isMaybeSingleStr', false);",
       "TAJS_assert(x, 'isMaybeStrOnlyUInt');",
       "TAJS_assert(x, 'isMaybeUndef');",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#23
0
 @Test
 public void functionWithForInAndLazyPropagationRecovery() {
   // should not crash
   Misc.init();
   Misc.runSource(
       "",
       "var o1 = {};",
       "function f(o2) {",
       "   for (var name in o2) {",
       "	    o1.p = o2[name]",
       "   }",
       "}",
       "f({a: 'a'});",
       "");
 }
示例#24
0
 @Test
 public void unorderedForInImplementation_withLazyPropagation() {
   Misc.init();
   Misc.captureSystemOutput();
   Misc.runSourceWithNamedFile(
       "unorderedForInImplementation_withLazyPropagation.js",
       "var o1 = {x: 'A', y: 'A'};",
       "var o2 = {};",
       "for(var p in o1){",
       "   o2[p] = o1[p];",
       "   TAJS_dumpObject(o2);",
       "}",
       "TAJS_dumpObject(o2);");
   Misc.checkSystemOutput();
 }
示例#25
0
 @Test
 public void readingVariablesFromOutSideLoop_bug() {
   Misc.init();
   Misc.runSource(
       "",
       "(function(){",
       "var u = Math.random();",
       "for(var p in {a: 'a'}){",
       "   if(u){",
       "       break;",
       "   }",
       "}",
       "TAJS_dumpValue('OK');",
       "})();");
 }
示例#26
0
 @Test
 public void concatenateNumberStrings() {
   // should not crash
   Misc.init();
   Misc.runSource(
       "",
       "var s = '1';",
       "for(var p in {2: '2', 3: '3'}){",
       "   s += p;",
       "}",
       "TAJS_assert(s, 'isMaybeStrIdentifierParts');", // optimal precision would not allow this
                                                       // case
       "TAJS_assert(s, 'isMaybeStrUInt');",
       "");
 }
示例#27
0
 @Test
 public void onePropertyReturnConstant() {
   Misc.init();
   Misc.runSource(
       "",
       "function f(){",
       "   for(var p in {a: 'a'}){",
       "       return 'x';",
       "   }",
       "}",
       "var x = f();",
       "x.KILL_UNDEFINED;",
       "TAJS_assert(x === 'x');",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#28
0
 @Test
 public void lhsEvaluatedAfterRhsLoop() {
   Misc.init();
   Misc.runSource(
       "",
       "function lhs(){ TAJS_assert(isAfterRhs === true); goesIntoLoop = true; return {};}",
       "var isAfterRhs = false;",
       "var goesIntoLoop = false;",
       "function make(){isAfterRhs = true; return {a: 'a'}};",
       "for(lhs().p in make()){",
       "}",
       "TAJS_assert(goesIntoLoop, 'isMaybeAnyBool');",
       "TAJS_assert(goesIntoLoop, 'isMaybeFalseButNotTrue', false);",
       "TAJS_assert(goesIntoLoop, 'isMaybeTrueButNotFalse', false);",
       "");
 }
示例#29
0
 @Test
 public void mutatingProperties() {
   Misc.init();
   Misc.runSource(
       "",
       "var x;",
       "var o = {a: 'a', b: 'b'};",
       "for(var p in o){",
       "   x = o[p];",
       "   o[p] = o[p] + o[p];",
       "}",
       "TAJS_assert(x, 'isMaybeSingleStr', false);",
       "TAJS_assert(x, 'isMaybeStrIdentifierParts');",
       "TAJS_assert(x, 'isMaybeUndef');",
       "TAJS_dumpValue('OK');",
       "");
 }
示例#30
0
 @Test
 public void twoPropertiesCopying() {
   Misc.init();
   Misc.runSource(
       "",
       "var o1 = {};",
       "var o2 = {a: 'a', b: 'b'};",
       "for(var p in o2){",
       "   o1[p] = o2[p];",
       "}",
       "o1.a.KILL_UNDEFINED",
       "o1.b.KILL_UNDEFINED",
       "TAJS_assert(o1.a === 'a');",
       "TAJS_assert(o1.b === 'b');",
       "TAJS_dumpValue('OK');",
       "");
 }