blob: 0a26480dbe49e7660fc8d4251908aba0914e03c8 (
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
|
// 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_T2;
* @section: 8.4, 7.8.4;
* @assertion: Assignment to string literals calls String constructor;
* @description: Compare empty string variable, object String('') and object String();
*/
var str="";
var strObj=new String("");
var strObj_=new String();
////////////////////////////////////////////////////////////
// CHECK#1
if (str.constructor !== strObj.constructor){
$ERROR('#1: "".constructor === new String("").constructor');
}
//
/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// CHECK#2
if (str.constructor !== strObj_.constructor){
$ERROR('#2: "".constructor === new String().constructor');
}
//
/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// CHECK#3
if (str != strObj){
$ERROR('#3: values of str=""; and strObj=new String(""); are equal');
}
//
/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// CHECK#4
if (str === strObj){
$ERROR('#4: objects of str=""; and strObj=new String(""); are different');
}
//
/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// CHECK#5
if (str != strObj_){
$ERROR('#5: values of str=""; and strObj=new String(); are equal');
}
//
/////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// CHECK#6
if (str === strObj_){
$ERROR('#6: objects of str=""; and strObj=new String(); are different');
}
//
/////////////////////////////////////////////////////////////
|