switch-001.js (1089B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 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 7 /** 8 File Name: switch-001.js 9 Section: 10 Description: 11 12 http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767 13 14 Verify that switches do not use strict equality in 15 versions of JavaScript < 1.4 16 17 Author: christine@netscape.com 18 Date: 12 november 1997 19 */ 20 var SECTION = "switch-001"; 21 var TITLE = "switch-001"; 22 var BUGNUMBER="315767"; 23 24 printBugNumber(BUGNUMBER); 25 writeHeaderToLog( SECTION + " "+ TITLE); 26 27 result = "fail: did not enter switch"; 28 29 switch (true) { 30 case 1: 31 result = "fail: for backwards compatibility, version 130 use strict equality"; 32 break; 33 case true: 34 result = "pass"; 35 break; 36 default: 37 result = "fail: evaluated default statement"; 38 } 39 40 new TestCase( 41 "switch / case should use strict equality in version of JS < 1.4", 42 "pass", 43 result ); 44 45 46 47 test();