blob: e3ceaca2b5a4262b494a2a469ed35875a9a3ebde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S11.4.1_A3.3;
* @section: 11.4.1;
* @assertion: If the property doesn't have the DontDelete attribute, remove the property;
* @description: Checking declared variable;
*/
// Converted for Test262 from original Sputnik source
ES5Harness.registerTest( {
id: "S11.4.1_A3.3",
path: "TestCases/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A3.3.js",
assertion: "If the property doesn\'t have the DontDelete attribute, remove the property",
description: "Checking declared variable",
test: function testcase() {
//CHECK#1
try {
x = 1;
delete x;
x;
$ERROR('#1: x = 1; delete x; x is not exist');
} catch (e) {
if (e instanceof ReferenceError !== true) {
$ERROR('#1: x = 1; delete x; x is not exist');
}
}
//CHECK#2
function MyFunction(){};
MyFunction.prop = 1;
delete MyFunction.prop;
if (MyFunction.prop !== undefined) {
$ERROR('#2: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop; MyFunction.prop === undefined. Actual: ' + (MyFunction.prop));
}
//CHECK#3
function MyFunction(){};
var MyObjectVar = new MyFunction();
MyObjectVar.prop = 1;
delete MyObjectVar.prop;
if (MyObjectVar.prop !== undefined) {
$ERROR('#3: function MyFunction(){}; var MyObjectVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectVar.prop; MyObjectVar.prop === undefined. Actual: ' + (MyObjectVar.prop));
}
//CHECK#4
if (delete MyObjectVar !== false) {
$ERROR('#4: function MyFunction(){}; var MyObjectVar = new MyFunction(); delete MyObjectVar === false');
}
//CHECK#5
function MyFunction(){};
MyObjectNotVar = new MyFunction();
MyObjectNotVar.prop = 1;
delete MyObjectNotVar.prop;
if (MyObjectNotVar.prop !== undefined) {
$ERROR('#5: function MyFunction(){}; MyObjectNotVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectNotVar.prop; MyObjectNotVar.prop === undefined. Actual: ' + (MyObjectNotVar.prop));
}
//CHECK#6
if (delete MyObjectNotVar !== true) {
$ERROR('#6: function MyFunction(){}; var MyObjectNotVar = new MyFunction(); delete MyObjectNotVar === true');
}
}
});
|