2757{
2759
2762
2765 win_skip(
"Could not create script\n");
2767 }
2768 IActiveScript_Release(
script);
2769 }
2770
2772
2775
2781
2787
2793
2799
2805
2807 parse_script_a(
"ok((delete testObj.deleteTest) === true, 'delete testObj.deleteTest did not return true');");
2809
2811 parse_script_a(
"ok((delete testObj.noDeleteTest) === false, 'delete testObj.noDeleteTest did not return false');");
2813
2816 parse_script_a(
"ok((delete testPropDelete) === true, 'delete testPropDelete did not return true');");
2819
2822 parse_script_a(
"ok((delete testNoPropDelete) === false, 'delete testPropDelete did not return false');");
2825
2831
2833 parse_script_a(
"ok((delete pureDisp.prop) === false, 'delete pureDisp.prop did not return true');");
2835
2837 parse_script_a(
"ok((delete pureDisp.noprop) === true, 'delete pureDisp.noprop did not return false');");
2839
2843
2847
2851
2853 parse_script_a(
"var t = {func: dispexFunc}; t = t.func(false);");
2855
2857 parse_script_a(
"Function.prototype.apply.call(dispexFunc, testObj, [true]);");
2859
2861 parse_script_a(
"Function.prototype.apply.call(pureDisp, testObj, [true]);");
2863
2865
2866 parse_script_a(
"ok(typeof(test) === 'object', \"typeof(test) != 'object'\");");
2867
2869
2873
2877
2879
2883
2887
2890 parse_script_a(
"(function () { eval('var testPropGet;'); })();");
2891
2893 parse_script_a(
"ok(propGetFunc() == 0, \"Incorrect propGetFunc value\");");
2895 parse_script_a(
"ok(propGetFunc(1) == 1, \"Incorrect propGetFunc value\");");
2896 parse_script_a(
"ok(propGetFunc(1, 2) == 2, \"Incorrect propGetFunc value\");");
2898 parse_script_a(
"ok(propGetFunc().toString() == 0, \"Incorrect propGetFunc value\");");
2900 parse_script_a(
"ok(propGetFunc(1).toString() == 1, \"Incorrect propGetFunc value\");");
2904
2906
2907 parse_script_a(
"(function() { var tmp = (function () { return testObj; })()(1);})();");
2908 parse_script_a(
"(function() { var tmp = (function () { return testObj; })()();})();");
2909
2910 parse_script_a(
"ok((testObj instanceof Object) === false, 'testObj is instance of Object');");
2911
2913 parse_script_a(
"ok(('prop' in testObj) === true, 'prop is not in testObj');");
2915
2917 parse_script_a(
"ok(('noprop' in testObj) === false, 'noprop is in testObj');");
2919
2921 parse_script_a(
"ok(Object.prototype.hasOwnProperty.call(testObj, 'prop') === true, 'hasOwnProperty(\\\"prop\\\") returned false');");
2923
2925 parse_script_a(
"ok(Object.prototype.hasOwnProperty.call(testObj, 'noprop') === false, 'hasOwnProperty(\\\"noprop\\\") returned true');");
2927
2929 parse_script_a(
"ok(Object.prototype.hasOwnProperty.call(pureDisp, 'prop') === true, 'hasOwnProperty(\\\"noprop\\\") returned false');");
2931
2933 parse_script_a(
"ok(Object.prototype.hasOwnProperty.call(pureDisp, 'noprop') === false, 'hasOwnProperty(\\\"noprop\\\") returned true');");
2935
2937 parse_script_a(
"ok(String(testObj) === '1', 'wrong testObj value');");
2939
2941 parse_script_a(
"ok(String.prototype.concat.call(testObj, ' OK') === '1 OK', 'wrong concat result');");
2943
2947
2953
2959
2965
2969 parse_script_a(
"var t = {func: function () { ok(this === t, 'this !== t'); }}; with(t) { func(); }");
2970 parse_script_a(
"function x() { testThis(this); }; with({y: 1}) { x(); }");
2971 parse_script_a(
"(function () { function x() { testThis(this);} x(); })();");
2972
2975 parse_script_a(
"ok(typeof(testObj.onlyDispID) === 'unknown', 'unexpected typeof(testObj.onlyDispID)');");
2978
2984
2990
2998
3006
3008 parse_script_a(
"testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp,"
3009 "function(i1,ui1,ui2,r4,i4ref,ui4,nullunk,d,i,s) {"
3010 " ok(getVT(i) === 'VT_I4', 'getVT(i) = ' + getVT(i));"
3011 " ok(getVT(s) === 'VT_I4', 'getVT(s) = ' + getVT(s));"
3012 " ok(getVT(d) === 'VT_DISPATCH', 'getVT(d) = ' + getVT(d));"
3013 " ok(getVT(nullunk) === 'VT_DISPATCH', 'getVT(nullunk) = ' + getVT(nullunk));"
3014 " ok(nullunk === null, 'nullunk !== null');"
3015 " ok(getVT(ui4) === 'VT_R8', 'getVT(ui4) = ' + getVT(ui4));"
3016 " ok(ui4 > 0, 'ui4 = ' + ui4);"
3017 " ok(getVT(i4ref) === 'VT_I4', 'getVT(i4ref) = ' + getVT(i4ref));"
3018 " ok(i4ref === 2, 'i4ref = ' + i4ref);"
3019 " ok(r4 === 0.5, 'r4 = ' + r4);"
3020 " ok(getVT(r4) === 'VT_R8', 'getVT(r4) = ' + getVT(r4));"
3021 " ok(getVT(ui2) === 'VT_I4', 'getVT(ui2) = ' + getVT(ui2));"
3022 " ok(getVT(ui1) === 'VT_I4', 'getVT(ui1) = ' + getVT(ui1));"
3023 " ok(ui1 === 4, 'ui1 = ' + ui1);"
3024 " ok(getVT(i1) === 'VT_I4', 'getVT(i1) = ' + getVT(i1));"
3025 " ok(i1 === 5, 'i1 = ' + i1);"
3026 "});");
3028
3031 parse_script_a(
"var t = (function () { with(testObj) { return withProp; }})(); ok(t === 1, 't = ' + t);");
3034
3036
3039 parse_script_a(
"@if(true)\nif(@_jscript) reportSuccess();\n@end");
3042
3050
3057 " var testEnumObj = new Enumerator(testObj);"
3058 " var tmp = testEnumObj.moveFirst();"
3059 " ok(tmp == undefined, \"testEnumObj.moveFirst() = \" + tmp);"
3060 "})()");
3064
3071 " var testEnumObj = new Enumerator(testObj);"
3072 " while (!testEnumObj.atEnd())"
3073 " {"
3074 " ok(testEnumObj.item() == 123, "
3075 " \"testEnumObj.item() = \"+testEnumObj.item());"
3076 " testEnumObj.moveNext();"
3077 " }"
3078 "})()");
3082
3087
3092
3095
3107 ok(
hres !=
S_OK,
"ParseScriptText have not failed\n");
3108
3112
3114 "?",
3115 0x800a03ea, 0, 0,
3116 "Microsoft JScript compilation error",
3117 "Syntax error",
3118 "?");
3119
3121 "var a=1;\nif(a\n-->0) a=5;\n",
3122 0x800a03ee, 2, 0,
3123 "Microsoft JScript compilation error",
3124 "Expected ')'",
3125 "-->0) a=5;");
3126
3128 "new 3;",
3129 0x800a01bd, 0, 0,
3130 "Microsoft JScript runtime error",
3131 "Object doesn't support this action",
3133
3135 "new null;",
3136 0x800a138f, 0, 0,
3137 "Microsoft JScript runtime error",
3138 "Object expected",
3140
3142 "var a;\nnew null;",
3143 0x800a138f, 1, 0,
3144 "Microsoft JScript runtime error",
3145 "Object expected",
3147
3149 "var a; new null;",
3150 0x800a138f, 0, 7,
3151 "Microsoft JScript runtime error",
3152 "Object expected",
3154
3156
3158}
static void test_isvisible(void)
static void test_invokeex(void)
static void test_eval(void)
static void parse_script_with_error_a(const char *src, SCODE errorcode, ULONG line, LONG pos, LPCSTR source, LPCSTR desc, LPCSTR linetext)
static void run_from_res(const char *name)
static void test_script_exprs(void)
static void parse_script_ae(const char *src, HRESULT exhres)
static void run_bom_tests(void)
static void test_automagic(void)
static void test_start(void)
#define parse_htmlscript_a(a)