Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/S15.2.2.1_A3_T1.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 When the Object constructor is called with one argument value and
7 the type of value is String, return ToObject(string)
8 es5id: 15.2.2.1_A3_T1
9 description: Argument value is a nonempty string
10 ---*/
11
12 var str = 'Obi-Wan Kenobi';
13
14 //CHECK#1
15 if (typeof str !== 'string') {
16 $ERROR('#1: "Obi-Wan Kenobi" is NOT a String');
17 }
18
19
20 var n_obj = new Object(str);
21
22 //CHECK#2
23 if (n_obj.constructor !== String) {
24 $ERROR('#2: When the Object constructor is called with String argument return ToObject(string)');
25 }
26
27 //CHECK#3
28 if (typeof n_obj !== 'object') {
29 $ERROR('#3: When the Object constructor is called with String argument return ToObject(string)');
30 }
31
32 //CHECK#4
33 if (n_obj != str) {
34 $ERROR('#4: When the Object constructor is called with String argument return ToObject(string)');
35 }
36
37 //CHECK#5
38 if (n_obj === str) {
39 $ERROR('#5: When the Object constructor is called with String argument return ToObject(string)');
40 }