js/src/tests/test262/ch12/12.10/S12.10_A1.1_T1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Copyright 2009 the Sputnik authors. All rights reserved.
michael@0 2 // This code is governed by the BSD license found in the LICENSE file.
michael@0 3
michael@0 4 /**
michael@0 5 * The with statement adds a computed object to the front of the
michael@0 6 * scope chain of the current execution context
michael@0 7 *
michael@0 8 * @path ch12/12.10/S12.10_A1.1_T1.js
michael@0 9 * @description Using "with" inside of global context leading to normal completion
michael@0 10 * @noStrict
michael@0 11 */
michael@0 12
michael@0 13 this.p1 = 1;
michael@0 14 this.p2 = 2;
michael@0 15 this.p3 = 3;
michael@0 16 var result = "result";
michael@0 17 var myObj = {p1: 'a',
michael@0 18 p2: 'b',
michael@0 19 p3: 'c',
michael@0 20 value: 'myObj_value',
michael@0 21 valueOf : function(){return 'obj_valueOf';},
michael@0 22 parseInt : function(){return 'obj_parseInt';},
michael@0 23 NaN : 'obj_NaN',
michael@0 24 Infinity : 'obj_Infinity',
michael@0 25 eval : function(){return 'obj_eval';},
michael@0 26 parseFloat : function(){return 'obj_parseFloat';},
michael@0 27 isNaN : function(){return 'obj_isNaN';},
michael@0 28 isFinite : function(){return 'obj_isFinite';}
michael@0 29 }
michael@0 30 var del;
michael@0 31 var st_p1 = "p1";
michael@0 32 var st_p2 = "p2";
michael@0 33 var st_p3 = "p3";
michael@0 34 var st_parseInt = "parseInt";
michael@0 35 var st_NaN = "NaN";
michael@0 36 var st_Infinity = "Infinity";
michael@0 37 var st_eval = "eval";
michael@0 38 var st_parseFloat = "parseFloat";
michael@0 39 var st_isNaN = "isNaN";
michael@0 40 var st_isFinite = "isFinite";
michael@0 41
michael@0 42 with(myObj){
michael@0 43 st_p1 = p1;
michael@0 44 st_p2 = p2;
michael@0 45 st_p3 = p3;
michael@0 46 st_parseInt = parseInt;
michael@0 47 st_NaN = NaN;
michael@0 48 st_Infinity = Infinity;
michael@0 49 st_eval = eval;
michael@0 50 st_parseFloat = parseFloat;
michael@0 51 st_isNaN = isNaN;
michael@0 52 st_isFinite = isFinite;
michael@0 53 p1 = 'x1';
michael@0 54 this.p2 = 'x2';
michael@0 55 del = delete p3;
michael@0 56 var p4 = 'x4';
michael@0 57 p5 = 'x5';
michael@0 58 var value = 'value';
michael@0 59 }
michael@0 60
michael@0 61 if(!(p1 === 1)){
michael@0 62 $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 );
michael@0 63 }
michael@0 64
michael@0 65 if(!(p2 === "x2")){
michael@0 66 $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 );
michael@0 67 }
michael@0 68
michael@0 69 if(!(p3 === 3)){
michael@0 70 $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 );
michael@0 71 }
michael@0 72
michael@0 73 if(!(p4 === "x4")){
michael@0 74 $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 );
michael@0 75 }
michael@0 76
michael@0 77 if(!(p5 === "x5")){
michael@0 78 $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 );
michael@0 79 }
michael@0 80
michael@0 81 if(!(myObj.p1 === "x1")){
michael@0 82 $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
michael@0 83 }
michael@0 84
michael@0 85 if(!(myObj.p2 === "b")){
michael@0 86 $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
michael@0 87 }
michael@0 88
michael@0 89 if(!(myObj.p3 === undefined)){
michael@0 90 $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
michael@0 91 }
michael@0 92
michael@0 93 if(!(myObj.p4 === undefined)){
michael@0 94 $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
michael@0 95 }
michael@0 96
michael@0 97 if(!(myObj.p5 === undefined)){
michael@0 98 $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
michael@0 99 }
michael@0 100
michael@0 101 if(!(st_parseInt !== parseInt)){
michael@0 102 $ERROR('#11: myObj.parseInt !== parseInt');
michael@0 103 }
michael@0 104
michael@0 105 if(!(st_NaN === "obj_NaN")){
michael@0 106 $ERROR('#12: myObj.NaN !== NaN');
michael@0 107 }
michael@0 108
michael@0 109 if(!(st_Infinity !== Infinity)){
michael@0 110 $ERROR('#13: myObj.Infinity !== Infinity');
michael@0 111 }
michael@0 112
michael@0 113 if(!(st_eval !== eval)){
michael@0 114 $ERROR('#14: myObj.eval !== eval');
michael@0 115 }
michael@0 116
michael@0 117 if(!(st_parseFloat !== parseFloat)){
michael@0 118 $ERROR('#15: myObj.parseFloat !== parseFloat');
michael@0 119 }
michael@0 120
michael@0 121 if(!(st_isNaN !== isNaN)){
michael@0 122 $ERROR('#16: myObj.isNaN !== isNaN');
michael@0 123 }
michael@0 124
michael@0 125 if(!(st_isFinite !== isFinite)){
michael@0 126 $ERROR('#17: myObj.isFinite !== isFinite');
michael@0 127 }
michael@0 128
michael@0 129 if(!(value === undefined)){
michael@0 130 $ERROR('#18: value === undefined. Actual: value ==='+ value );
michael@0 131 }
michael@0 132
michael@0 133 if(!(myObj.value === "value")){
michael@0 134 $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
michael@0 135 }
michael@0 136

mercurial