Debian Codegraph @

rhino/testsrc/tests/js1_2/operator/strictEquality.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = 'strictEquality.js';
7
8 /**
9 Filename: strictEquality.js
10 Description: 'This tests the operator ==='
11
12 Author: Nick Lerissa
13 Date: Fri Feb 13 09:58:28 PST 1998
14 */
15
16 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
17 var VERSION = 'no version';
18 startTest();
19 var TITLE = 'operator "==="';
20
21 writeHeaderToLog('Executing script: strictEquality.js');
22 writeHeaderToLog( SECTION + " "+ TITLE);
23
24 new TestCase( SECTION, "('8' === 8) ",
25 false, ('8' === 8));
26
27 new TestCase( SECTION, "(8 === 8) ",
28 true, (8 === 8));
29
30 new TestCase( SECTION, "(8 === true) ",
31 false, (8 === true));
32
33 new TestCase( SECTION, "(new String('') === new String('')) ",
34 false, (new String('') === new String('')));
35
36 new TestCase( SECTION, "(new Boolean(true) === new Boolean(true))",
37 false, (new Boolean(true) === new Boolean(true)));
38
39 var anObject = { one:1 , two:2 };
40
41 new TestCase( SECTION, "(anObject === anObject) ",
42 true, (anObject === anObject));
43
44 new TestCase( SECTION, "(anObject === { one:1 , two:2 }) ",
45 false, (anObject === { one:1 , two:2 }));
46
47 new TestCase( SECTION, "({ one:1 , two:2 } === anObject) ",
48 false, ({ one:1 , two:2 } === anObject));
49
50 new TestCase( SECTION, "(null === null) ",
51 true, (null === null));
52
53 new TestCase( SECTION, "(null === 0) ",
54 false, (null === 0));
55
56 new TestCase( SECTION, "(true === !false) ",
57 true, (true === !false));
58
59 test();
60