blob: 71c76b8da318af73e9a890d830ea33259ff22e31 (
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
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S8.4_A9_T1;
* @section: 8.4, 7.8.4;
* @assertion: Assignment to string literals calls String constructor;
* @description: Simple string variable compare with object String;
*/
// Converted for Test262 from original Sputnik source
ES5Harness.registerTest( {
id: "S8.4_A9_T1",
path: "TestCases/08_Types/8.4_The_String_Type/S8.4_A9_T1.js",
assertion: "Assignment to string literals calls String constructor",
description: "Simple string variable compare with object String",
test: function testcase() {
var str='ABC';
var strObj=new String('ABC');
////////////////////////////////////////////////////////////
// CHECK#1
if (str.constructor !== strObj.constructor){
$ERROR('#1: \'ABC\'.constructor === new String(\'ABC\').constructor');
}
//
/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// CHECK#2
if (str != strObj){
$ERROR('#2: "ABC" == new String("ABC")');
}
//
/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// CHECK#3
if (str === strObj){
$ERROR('#3: "ABC" !== new String("ABC")');
}
//
/////////////////////////////////////////////////////////////
}
});
|