js/src/tests/ecma_2/Statements/switch-001.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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/. */
     7 /**
     8  *  File Name:          switch-001.js
     9  *  ECMA Section:
    10  *  Description:        The switch Statement
    11  *
    12  *  A simple switch test with no abrupt completions.
    13  *
    14  *  Author:             christine@netscape.com
    15  *  Date:               11 August 1998
    16  *
    17  */
    18 var SECTION = "switch-001";
    19 var VERSION = "ECMA_2";
    20 var TITLE   = "The switch statement";
    22 var BUGNUMBER="315767";
    24 startTest();
    25 writeHeaderToLog( SECTION + " "+ TITLE);
    27 SwitchTest( 0, 126 );
    28 SwitchTest( 1, 124 );
    29 SwitchTest( 2, 120 );
    30 SwitchTest( 3, 112 );
    31 SwitchTest( 4, 64 );
    32 SwitchTest( 5, 96 );
    33 SwitchTest( true, 96 );
    34 SwitchTest( false, 96 );
    35 SwitchTest( null, 96 );
    36 SwitchTest( void 0, 96 );
    37 SwitchTest( "0", 96 );
    39 test();
    41 function SwitchTest( input, expect ) {
    42   var result = 0;
    44   switch ( input ) {
    45   case 0:
    46     result += 2;
    47   case 1:
    48     result += 4;
    49   case 2:
    50     result += 8;
    51   case 3:
    52     result += 16;
    53   default:
    54     result += 32;
    55   case 4:
    56     result +=64;
    57   }
    59   new TestCase(
    60     SECTION,
    61     "switch with no breaks, case expressions are numbers.  input is "+
    62     input,
    63     expect,
    64     result );
    65 }

mercurial