How to use writeLine method in ava

Best JavaScript code snippet using ava

objtypespec-newobj.2.js

Source:objtypespec-newobj.2.js Github

copy

Full Screen

1//-------------------------------------------------------------------------------------------------------2// Copyright (C) Microsoft. All rights reserved.3// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.4//-------------------------------------------------------------------------------------------------------5function writeLine(v) {6 v = v.replace(/\(PDT\)/g, "(Pacific Daylight Time)")7 .replace(/\(PST\)/g, "(Pacific Standard Time)");8 WScript.Echo(v);9}10// Test the happy path of the new object optimization involving built-ins.11writeLine("Test 01:");12function test01() {13 var o = new Array();14 o.x = 4;15 o.y = 5;16 o.z = 6;17 return o;18}19var o = test01();20writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");21o = test01();22writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");23o = test01();24writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");25writeLine("");26writeLine("Test 02:");27var proto02 = { p: 1001, q: 1002 };28function test02() {29 var o = new Array(10);30 o.x = 4;31 o.y = 5;32 o.z = 6;33 return o;34}35var o = test02();36writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");37o = test02();38writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");39o = test02();40writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");41writeLine("");42writeLine("Test 03:");43var proto03 = { p: 1001, q: 1002 };44Array.prototype = proto03;45function test03() {46 var o = new Array();47 o.x = 4;48 o.y = 5;49 o.z = 6;50 return o;51}52var o = test03();53writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");54o = test03();55writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");56o = test03();57writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");58writeLine("");59writeLine("Test 04:");60function SimpleObject04() {61 this.a = 1;62 this.b = 2;63 this.c = 3;64}65var proto04 = { p: 1001, q: 1002 };66SimpleObject04.prototype = proto04;67Array = SimpleObject04;68function test04() {69 var o = new Array();70 o.x = 4;71 o.y = 5;72 o.z = 6;73 return o;74}75var o = test04();76writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");77o = test04();78writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");79o = test04();80writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");81writeLine("");82writeLine("Test 11:");83function test11() {84 var o = new Boolean();85 o.x = 4;86 o.y = 5;87 o.z = 6;88 return o;89}90var o = test11();91writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");92o = test11();93writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");94o = test11();95writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");96writeLine("");97writeLine("Test 12:");98var proto12 = { p: 1001, q: 1002 };99function test12() {100 var o = new Boolean(true);101 o.x = 4;102 o.y = 5;103 o.z = 6;104 return o;105}106var o = test12();107writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");108o = test12();109writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");110o = test12();111writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");112writeLine("");113writeLine("Test 13:");114var proto13 = { p: 1001, q: 1002 };115Boolean.prototype = proto13;116function test13() {117 var o = new Boolean();118 o.x = 4;119 o.y = 5;120 o.z = 6;121 return o;122}123var o = test13();124writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");125o = test13();126writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");127o = test13();128writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");129writeLine("");130writeLine("Test 14:");131function SimpleObject14() {132 this.a = 1;133 this.b = 2;134 this.c = 3;135}136var proto14 = { p: 1001, q: 1002 };137SimpleObject14.prototype = proto14;138Boolean = SimpleObject14;139function test14() {140 var o = new Boolean();141 o.x = 4;142 o.y = 5;143 o.z = 6;144 return o;145}146var o = test14();147writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");148o = test14();149writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");150o = test14();151writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");152writeLine("");153writeLine("Test 21:");154function test21() {155 var o = new Number();156 o.x = 4;157 o.y = 5;158 o.z = 6;159 return o;160}161var o = test21();162writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");163o = test21();164writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");165o = test21();166writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");167writeLine("");168writeLine("Test 22:");169var proto22 = { p: 1001, q: 1002 };170function test22() {171 var o = new Number(0);172 o.x = 4;173 o.y = 5;174 o.z = 6;175 return o;176}177var o = test22();178writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");179o = test22();180writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");181o = test22();182writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");183writeLine("");184writeLine("Test 23:");185var proto23 = { p: 1001, q: 1002 };186Number.prototype = proto23;187function test23() {188 var o = new Number();189 o.x = 4;190 o.y = 5;191 o.z = 6;192 return o;193}194var o = test23();195writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");196o = test23();197writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");198o = test23();199writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");200writeLine("");201writeLine("Test 24:");202function SimpleObject24() {203 this.a = 1;204 this.b = 2;205 this.c = 3;206}207var proto24 = { p: 1001, q: 1002 };208SimpleObject24.prototype = proto24;209Number = SimpleObject24;210function test24() {211 var o = new Number();212 o.x = 4;213 o.y = 5;214 o.z = 6;215 return o;216}217var o = test24();218writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");219o = test24();220writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");221o = test24();222writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");223writeLine("");224writeLine("Test 31:");225function test31() {226 var o = new String();227 o.x = 4;228 o.y = 5;229 o.z = 6;230 return o;231}232var o = test31();233writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");234o = test31();235writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");236o = test31();237writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");238writeLine("");239writeLine("Test 32:");240var proto32 = { p: 1001, q: 1002 };241function test32() {242 var o = new String("text");243 o.x = 4;244 o.y = 5;245 o.z = 6;246 return o;247}248var o = test32();249writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");250o = test32();251writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");252o = test32();253writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");254writeLine("");255writeLine("Test 33:");256var proto33 = { p: 1001, q: 1002 };257String.prototype = proto33;258function test33() {259 var o = new String();260 o.x = 4;261 o.y = 5;262 o.z = 6;263 return o;264}265var o = test33();266writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");267o = test33();268writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");269o = test33();270writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");271writeLine("");272writeLine("Test 34:");273function SimpleObject34() {274 this.a = 1;275 this.b = 2;276 this.c = 3;277}278var proto34 = { p: 1001, q: 1002 };279SimpleObject34.prototype = proto34;280String = SimpleObject34;281function test34() {282 var o = new String();283 o.x = 4;284 o.y = 5;285 o.z = 6;286 return o;287}288var o = test34();289writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");290o = test34();291writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");292o = test34();293writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");294writeLine("");295writeLine("Test 41:");296function test41() {297 var o = new Date("2013/12/03");298 o.x = 4;299 o.y = 5;300 o.z = 6;301 return o;302}303var o = test41();304writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");305o = test41();306writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");307o = test41();308writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");309writeLine("");310writeLine("Test 42:");311var proto42 = { p: 1041, q: 1042 };312Date.prototype = proto42;313function test42() {314 var o = new Date("2013/12/03");315 o.x = 4;316 o.y = 5;317 o.z = 6;318 return o;319}320var o = test42();321writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");322o = test42();323writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");324o = test42();325writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");326writeLine("");327writeLine("Test 43:");328function SimpleObject43() {329 this.a = 1;330 this.b = 2;331 this.c = 3;332}333var proto43 = { p: 1041, q: 1042 };334SimpleObject43.prototype = proto43;335Date = SimpleObject43;336function test43() {337 var o = new Date();338 o.x = 4;339 o.y = 5;340 o.z = 6;341 return o;342}343var o = test43();344writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");345o = test43();346writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");347o = test43();348writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");349writeLine("");350writeLine("Test 51:");351function test51() {352 var o = new Object();353 o.x = 4;354 o.y = 5;355 o.z = 6;356 return o;357}358var o = test51();359writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");360o = test51();361writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");362o = test51();363writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");364writeLine("");365writeLine("Test 52:");366var proto52 = { p: 1041, q: 1042 };367function test52() {368 var o = new Object(proto52);369 o.x = 4;370 o.y = 5;371 o.z = 6;372 return o;373}374var o = test52();375writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");376o = test52();377writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");378o = test52();379writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");380writeLine("");381writeLine("Test 53:");382var proto53 = { p: 1041, q: 1042 };383Object.prototype = proto53;384function test53() {385 var o = new Object();386 o.x = 4;387 o.y = 5;388 o.z = 6;389 return o;390}391var o = test53();392writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");393o = test53();394writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");395o = test53();396writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");397writeLine("");398writeLine("Test 54:");399function SimpleObject54() {400 this.a = 1;401 this.b = 2;402 this.c = 3;403}404var proto54 = { p: 1001, q: 1002 };405SimpleObject54.prototype = proto54;406Object = SimpleObject54;407function test54() {408 var o = new Object();409 o.x = 4;410 o.y = 5;411 o.z = 6;412 return o;413}414var o = test54();415writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");416o = test54();417writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");418o = test54();419writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");420writeLine("");421writeLine("Test 55:");422function SimpleObject55() {423 this.a = 1;424 this.b = 2;425 this.c = 3;426}427var proto55a = { p: 1041, q: 1042 };428var proto55b = { p: 1051, q: 1052 };429SimpleObject55.prototype = proto55a;430Object = SimpleObject55;431function test55() {432 var o = new Object(proto55b);433 o.x = 4;434 o.y = 5;435 o.z = 6;436 return o;437}438var o = test55();439writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");440o = test55();441writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");442o = test55();443writeLine("o = " + o + " ({ a: " + o.a + ", b: " + o.b + ", c: " + o.c + ", p: " + o.p + ", q: " + o.q + ", x: " + o.x + ", y: " + o.y + " })");...

Full Screen

Full Screen

Conversions.js

Source:Conversions.js Github

copy

Full Screen

...7// test is zone-specific, in other zones, the test will most likely fail. The result is only valid in the Pacific time zone.8// NOTE: If DST rules change again in the PST time zone, these test cases will need to be changed to use different boundary date9// values as appropriate for the new DST rules compared with the old DST rules.10////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////11writeLine("--- Standard Time (ST) conversions ---");12writeLine("");13writeLine("January 31, 2006 - UTC to local - ST");14var t = new Date(Date.UTC(2006, 0, 31, 18, 0));15writeLine(t.toUTCString());16writeLine(t.toLocaleString());17writeLine("");18writeLine("January 31, 2006 - local to UTC - ST");19var t = new Date(Date.parse("January 31, 2006 11:00 AM"));20writeLine(t.toLocaleString());21writeLine(t.toUTCString());22writeLine("");23writeLine("January 31, 2007 - UTC to local - ST");24var t = new Date(Date.UTC(2007, 0, 31, 18, 0));25writeLine(t.toUTCString());26writeLine(t.toLocaleString());27writeLine("");28writeLine("January 31, 2007 - local to UTC - ST");29var t = new Date(Date.parse("January 31, 2007 11:00 AM"));30writeLine(t.toLocaleString());31writeLine(t.toUTCString());32writeLine("");33////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////34writeLine("--- Daylight Time (DT) conversions ---");35writeLine("");36writeLine("July 15, 2006 - UTC to local - DT");37var t = new Date(Date.UTC(2006, 6, 31, 18, 0));38writeLine(t.toUTCString());39writeLine(t.toLocaleString());40writeLine("");41writeLine("July 15, 2006 - local to UTC - DT");42var t = new Date(Date.parse("July 15, 2006 11:00 AM"));43writeLine(t.toLocaleString());44writeLine(t.toUTCString());45writeLine("");46writeLine("July 15, 2007 - UTC to local - DT");47var t = new Date(Date.UTC(2007, 6, 31, 18, 0));48writeLine(t.toUTCString());49writeLine(t.toLocaleString());50writeLine("");51writeLine("July 15, 2007 - local to UTC - DT");52var t = new Date(Date.parse("July 15, 2007 11:00 AM"));53writeLine(t.toLocaleString());54writeLine(t.toUTCString());55writeLine("");56////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////57writeLine("--- Boundary conversions between old and new rules ---");58writeLine("");59// In 2007, the DST rules in the Pacific time zone changed. Instead of transitioning into DST in April, the transition60// happens in March, and instead of transitioning into Standard Time in October, the transition happens in November.61// So, we test using March 31, 2006/2007 and October 31, 2006/2007. These dates fall in between the transition times in 200662// and 2007. The expected behavior is that we always use the current year's DST rules when applying the DST adjustment. So63// even for the dates in 2006, we should use the current rules for conversion.64writeLine("March 31, 2006 - UTC to local - ST in 2006 rules");65var t = new Date(Date.UTC(2006, 2, 31, 18, 0));66writeLine(t.toUTCString());67writeLine(t.toLocaleString());68writeLine("");69writeLine("March 31, 2006 - local to UTC - ST in 2006 rules");70var t = new Date(Date.parse("March 31, 2006 11:00 AM"));71writeLine(t.toLocaleString());72writeLine(t.toUTCString());73writeLine("");74writeLine("March 31, 2007 - UTC to local - DT in 2007 rules");75var t = new Date(Date.UTC(2007, 2, 31, 18, 0));76writeLine(t.toUTCString());77writeLine(t.toLocaleString());78writeLine("");79writeLine("March 31, 2007 - local to UTC - DT in 2007 rules");80var t = new Date(Date.parse("March 31, 2007 11:00 AM"));81writeLine(t.toLocaleString());82writeLine(t.toUTCString());83writeLine("");84writeLine("October 31, 2006 - UTC to local - ST in 2006 rules");85var t = new Date(Date.UTC(2006, 9, 31, 18, 0));86writeLine(t.toUTCString());87writeLine(t.toLocaleString());88writeLine("");89writeLine("October 31, 2006 - local to UTC - ST in 2006 rules");90var t = new Date(Date.parse("October 31, 2006 11:00 AM"));91writeLine(t.toLocaleString());92writeLine(t.toUTCString());93writeLine("");94writeLine("October 31, 2007 - UTC to local - DT in 2007 rules");95var t = new Date(Date.UTC(2007, 9, 31, 18, 0));96writeLine(t.toUTCString());97writeLine(t.toLocaleString());98writeLine("");99writeLine("October 31, 2007 - local to UTC - DT in 2007 rules");100var t = new Date(Date.parse("October 31, 2007 11:00 AM"));101writeLine(t.toLocaleString());102writeLine(t.toUTCString());103writeLine("");104////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////105writeLine("--- Boundary conversions when transitioning into DT ---");106writeLine("");107writeLine("March 11, 2007 2:00 AM transition - UTC to local");108var t = new Date(Date.UTC(2007, 2, 11, 9, 30));109writeLine(t.toUTCString());110writeLine(t.toLocaleString());111var t = new Date(Date.UTC(2007, 2, 11, 10, 30));112writeLine(t.toUTCString());113writeLine(t.toLocaleString());114var t = new Date(Date.UTC(2007, 2, 11, 11, 30));115writeLine(t.toUTCString());116writeLine(t.toLocaleString());117writeLine("");118writeLine("March 11, 2007 2:00 AM transition - local to UTC");119var t = new Date(Date.parse("March 11, 2007 1:30 AM"));120writeLine(t.toLocaleString());121writeLine(t.toUTCString());122var t = new Date(Date.parse("March 11, 2007 2:30 AM"));123writeLine(t.toLocaleString());124writeLine(t.toUTCString());125var t = new Date(Date.parse("March 11, 2007 3:30 AM"));126writeLine(t.toLocaleString());127writeLine(t.toUTCString());128writeLine("");129////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////130writeLine("--- Boundary conversions when transitioning into ST ---");131writeLine("");132writeLine("November 4, 2007 2:00 AM transition - UTC to local");133var t = new Date(Date.UTC(2007, 10, 4, 8, 30));134writeLine(t.toUTCString());135writeLine(t.toLocaleString());136var t = new Date(Date.UTC(2007, 10, 4, 9, 30));137writeLine(t.toUTCString());138writeLine(t.toLocaleString());139var t = new Date(Date.UTC(2007, 10, 4, 10, 30));140writeLine(t.toUTCString());141writeLine(t.toLocaleString());142writeLine("");143writeLine("November 4, 2007 2:00 AM transition - local to UTC");144var t = new Date(Date.parse("November 4, 2007 12:30 AM"));145writeLine(t.toLocaleString());146writeLine(t.toUTCString());147var t = new Date(Date.parse("November 4, 2007 1:30 AM"));148writeLine(t.toLocaleString());149writeLine(t.toUTCString());150var t = new Date(Date.parse("November 4, 2007 2:30 AM"));151writeLine(t.toLocaleString());152writeLine(t.toUTCString());153writeLine("");154////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////155// Helpers156function writeLine(str)157{158 WScript.Echo("" + str);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var myModule = require('./myModule');2myModule.writeLine("Hello World");3exports.writeLine = function (message) {4 console.log(message);5}6var writeLine = function (message) {7 console.log(message);8};9module.exports = {10};11var myModule = require('./myModule');12myModule.writeLine("Hello World");13var writeLine = function (message) {14 console.log(message);15};16module.exports = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var fs = require('fs');2var logger = require('./logger.js');3var logger2 = require('./logger2.js');4logger.writeLine("Hello World");5logger2.writeLine("Hello World Again");6var fs = require('fs');7exports.writeLine = function (message) {8 fs.appendFile('log.txt', message + '\n', function (err) {9 if (err) throw err;10 });11}12var fs = require('fs');13exports.writeLine = function (message) {14 fs.appendFile('log2.txt', message + '\n', function (err) {15 if (err) throw err;16 });17}

Full Screen

Using AI Code Generation

copy

Full Screen

1var writeLine = require('./writeLine');2writeLine.writeLine('Hello World');3writeLine.writeLine('Good Bye');4var writeLine = function (text) {5 console.log(text);6}7exports.writeLine = writeLine;8var writeLine = function (text) {9 console.log(text);10}11module.exports = writeLine;12var writeLine = function (text) {13 console.log(text);14}15module.exports = {16};17var writeLine = function (text) {18 console.log(text);19}20var writeError = function (text) {21 console.error(text);22}23module.exports = {24};25var writeLine = require('./writeLine');26writeLine.writeLine('Hello World');27writeLine.writeError('Good Bye');28var writeLine = require('./writeLine');29writeLine.writeLine('Hello World');30writeLine.writeError('Good Bye');

Full Screen

Using AI Code Generation

copy

Full Screen

1var writeLine = require('./writeLine');2writeLine('Hello World');3var writeLine = require('./writeLine');4writeLine('Hello World');5module.exports = function (text) {6 console.log(text);7}8var writeLine = require('./writeLine');9writeLine('Hello World');10module.exports = function (text) {11 console.log(text);12}13var writeLine = require('./writeLine');14writeLine('Hello World');15module.exports = function (text) {16 console.log(text);17}18var writeLine = require('./writeLine');19writeLine('Hello World');20module.exports = function (text) {21 console.log(text);22}23var writeLine = require('./writeLine');24writeLine('Hello World');25module.exports = function (text) {26 console.log(text);27}28var writeLine = require('./writeLine');29writeLine('Hello World');30module.exports = function (text) {31 console.log(text);32}33var writeLine = require('./writeLine');

Full Screen

Using AI Code Generation

copy

Full Screen

1var writeLine = require('./writeline.js').writeLine;2writeLine("Hello World!");3exports.writeLine = function(message) {4 console.log(message);5}6var writeLine = require('./writeline.js').writeLine;7writeLine("Hello World!");8exports.writeLine = function(message) {9 console.log(message);10}11var writeLine = require('./writeline.js').writeLine;12writeLine("Hello World!");13exports.writeLine = function(message) {14 console.log(message);15}16var writeLine = require('./writeline.js').writeLine;17writeLine("Hello World!");18exports.writeLine = function(message) {19 console.log(message);20}21var writeLine = require('./writeline.js').writeLine;22writeLine("Hello World!");23exports.writeLine = function(message) {24 console.log(message);25}26var writeLine = require('./writeline.js').writeLine;27writeLine("Hello World!");28exports.writeLine = function(message) {29 console.log(message);30}31var writeLine = require('./writeline.js').writeLine;32writeLine("Hello World!");33exports.writeLine = function(message) {34 console.log(message);35}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ava automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful