mirror of
https://github.com/SSCLI/sscli_20021101
synced 2026-06-08 12:28:57 +00:00
9fa3874800
Moved the original file to the archive subfolder.
356 lines
10 KiB
JavaScript
356 lines
10 KiB
JavaScript
//# ==++==
|
|
//#
|
|
//#
|
|
//# Copyright (c) 2002 Microsoft Corporation. All rights reserved.
|
|
//#
|
|
//# The use and distribution terms for this software are contained in the file
|
|
//# named license.txt, which can be found in the root of this distribution.
|
|
//# By using this software in any fashion, you are agreeing to be bound by the
|
|
//# terms of this license.
|
|
//#
|
|
//# You must not remove this notice, or any other, from this software.
|
|
//#
|
|
//#
|
|
//# ==--==
|
|
//####################################################################################
|
|
@cc_on
|
|
|
|
|
|
import System;
|
|
|
|
var NULL_DISPATCH = null;
|
|
var apGlobalObj;
|
|
var apPlatform;
|
|
var lFailCount;
|
|
|
|
|
|
var iTestID = 53685;
|
|
|
|
function FuncRetVal() { return "655.35"; }
|
|
function FuncRetNulVal() { return ""; }
|
|
function myObject() { this.retVal = myObjVal(); }
|
|
function myObjVal() { return 123321; }
|
|
|
|
function strop07() {
|
|
var tmp,res,expected,emptyVar;
|
|
|
|
var myDate = new Date();
|
|
myDate.setTime(0); // this is Wed Dec 31 16:00:00 PST 1969
|
|
|
|
var numvar = 4321;
|
|
var strvar = "57";
|
|
var strvarnul = "";
|
|
var boolvar = new Boolean(true);
|
|
|
|
var ary = new Array();
|
|
ary[2] = 12.14;
|
|
ary[3] = 13.14;
|
|
ary[4] = 15.14;
|
|
|
|
var myObj = new myObject();
|
|
var myStr = new String("112");
|
|
|
|
apInitTest("strop07");
|
|
|
|
apInitScenario("string literal += expr");
|
|
res = "0.0"; res += "alpha" + "beta";
|
|
expected = "0.0alphabeta";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += funcretval");
|
|
res = "0.0"; res += FuncRetVal();
|
|
expected = "0.0655.35";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += literal");
|
|
res = "0.0"; res += "JavaScript";
|
|
expected = "0.0JavaScript";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += variable");
|
|
res = "0.0"; res += strvar;
|
|
expected = "0.057";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += null expr");
|
|
res = "0.0"; res += "" + "";
|
|
expected = "0.0";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += null funcretval");
|
|
res = "0.0"; res += FuncRetNulVal();
|
|
expected = "0.0";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += null literal");
|
|
res = "0.0"; res += "";
|
|
expected = "0.0";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += null variable");
|
|
res = "0.0"; res += strvarnul;
|
|
expected = "0.0";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += boolean");
|
|
res = "0.0"; res += boolvar;
|
|
expected = "0.0true";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += numeric literal");
|
|
res = "0.0"; res += 55.2;
|
|
expected = "0.055.2";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += numeric var");
|
|
res = "0.0"; res += numvar;
|
|
expected = "0.04321";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal += object");
|
|
res = "0.0"; res += myObj;
|
|
expected = "0.0[object Object]";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
if( new Date("12/25/2002 12:00:00 PST").getTimezoneOffset()/60 == 8) {
|
|
apInitScenario("string literal += date");
|
|
res = "0.0"; res += myDate;
|
|
expected = "0.0Wed Dec 31 16:00:00 PST 1969";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
}
|
|
|
|
apInitScenario("string literal + expr");
|
|
res = "0.0" + "alpha" + "beta";
|
|
expected = "0.0alphabeta";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + funcretval");
|
|
res = "0.0" + FuncRetVal();
|
|
expected = "0.0655.35";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + literal");
|
|
res = "0.0" + "JavaScript";
|
|
expected = "0.0JavaScript";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + variable");
|
|
res = "0.0" + strvar;
|
|
expected = "0.057";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + null expr");
|
|
res = "0.0" + "" + "";
|
|
expected = "0.0";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + null funcretval");
|
|
res = "0.0" + FuncRetNulVal();
|
|
expected = "0.0";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + null literal");
|
|
res = "0.0" + "";
|
|
expected = "0.0";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + null variable");
|
|
res = "0.0" + strvarnul;
|
|
expected = "0.0";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + boolean");
|
|
res = "0.0" + boolvar;
|
|
expected = "0.0true";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + numeric literal");
|
|
res = "0.0" + 55.2;
|
|
expected = "0.055.2";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + numeric var");
|
|
res = "0.0" + numvar;
|
|
expected = "0.04321";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
apInitScenario("string literal + object");
|
|
res = "0.0" + myObj;
|
|
expected = "0.0[object Object]";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
|
|
if( new Date("12/25/2002 12:00:00 PST").getTimezoneOffset()/60 == 8) {
|
|
apInitScenario("string literal + date");
|
|
res = "0.0" + myDate;
|
|
expected = "0.0Wed Dec 31 16:00:00 PST 1969";
|
|
if (res != expected) {
|
|
apLogFailInfo("wrong result",expected,res,"");
|
|
}
|
|
if (typeof(res) != typeof(expected)) {
|
|
apLogFailInfo("wrong result",typeof(expected),typeof(res),"");
|
|
}
|
|
}
|
|
|
|
apEndTest();
|
|
}
|
|
|
|
|
|
strop07();
|
|
|
|
|
|
if(lFailCount >= 0) System.Environment.ExitCode = lFailCount;
|
|
else System.Environment.ExitCode = 1;
|
|
|
|
function apInitTest(stTestName) {
|
|
lFailCount = 0;
|
|
|
|
apGlobalObj = new Object();
|
|
apGlobalObj.apGetPlatform = function Funca() { return "Rotor" }
|
|
apGlobalObj.LangHost = function Funcb() { return 1033;}
|
|
apGlobalObj.apGetLangExt = function Funcc(num) { return "EN"; }
|
|
|
|
apPlatform = apGlobalObj.apGetPlatform();
|
|
var sVer = "1.0"; //navigator.appVersion.toUpperCase().charAt(navigator.appVersion.toUpperCase().indexOf("MSIE")+5);
|
|
apGlobalObj.apGetHost = function Funcp() { return "Rotor " + sVer; }
|
|
print ("apInitTest: " + stTestName);
|
|
}
|
|
|
|
function apInitScenario(stScenarioName) {print( "\tapInitScenario: " + stScenarioName);}
|
|
|
|
function apLogFailInfo(stMessage, stExpected, stActual, stBugNum) {
|
|
lFailCount = lFailCount + 1;
|
|
print ("***** FAILED:");
|
|
print ("\t\t" + stMessage);
|
|
print ("\t\tExpected: " + stExpected);
|
|
print ("\t\tActual: " + stActual);
|
|
}
|
|
|
|
function apGetLocale(){ return 1033; }
|
|
function apWriteDebug(s) { print("dbg ---> " + s) }
|
|
function apEndTest() {}
|