testPyScriptlet.js
1 function print(msg) 2 { 3 WScript.Echo(msg) ; 4 } 5 6 function check(condition, msg) 7 { 8 if (!condition) { 9 print("***** testPyScriptlet.js failed *****"); 10 print(msg); 11 } 12 } 13 14 var thisScriptEngine = ScriptEngine() ; 15 16 var majorVersion = ScriptEngineMajorVersion() ; 17 var minorVersion = ScriptEngineMinorVersion() ; 18 var buildVersion = ScriptEngineBuildVersion() ; 19 20 WScript.Echo(thisScriptEngine + " Version " + majorVersion + "." + minorVersion + " Build " + buildVersion) ; 21 22 var scriptlet = new ActiveXObject("TestPys.Scriptlet") ; 23 24 check(scriptlet.PyProp1=="PyScript Property1", "PyProp1 wasn't correct initial value"); 25 scriptlet.PyProp1 = "New Value"; 26 check(scriptlet.PyProp1=="New Value", "PyProp1 wasn't correct new value"); 27 28 check(scriptlet.PyProp2=="PyScript Property2", "PyProp2 wasn't correct initial value"); 29 scriptlet.PyProp2 = "Another New Value"; 30 check(scriptlet.PyProp2=="Another New Value", "PyProp2 wasn't correct new value"); 31 32 check(scriptlet.PyMethod1()=="PyMethod1 called", "Method1 wrong value"); 33 check(scriptlet.PyMethod2()=="PyMethod2 called", "Method2 wrong value");