js/src/tests/js1_5/Regress/regress-203841.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     6 /*
     7  *
     8  * Date:    29 April 2003
     9  * SUMMARY: Testing merged if-clauses
    10  *
    11  * See http://bugzilla.mozilla.org/show_bug.cgi?id=203841
    12  *
    13  */
    14 //-----------------------------------------------------------------------------
    15 var UBound = 0;
    16 var BUGNUMBER = 203841;
    17 var summary = 'Testing merged if-clauses';
    18 var status = '';
    19 var statusitems = [];
    20 var actual = '';
    21 var actualvalues = [];
    22 var expect= '';
    23 var expectedvalues = [];
    26 status = inSection(1);
    27 var a = 0;
    28 var b = 0;
    29 var c = 0;
    30 if (a == 5, b == 6) { c = 1; }
    31 actual = c;
    32 expect = 0;
    33 addThis();
    35 status = inSection(2);
    36 a = 5;
    37 b = 0;
    38 c = 0;
    39 if (a == 5, b == 6) { c = 1; }
    40 actual = c;
    41 expect = 0;
    42 addThis();
    44 status = inSection(3);
    45 a = 5;
    46 b = 6;
    47 c = 0;
    48 if (a == 5, b == 6) { c = 1; }
    49 actual = c;
    50 expect = 1;
    51 addThis();
    53 /*
    54  * Now get tricky and use the = operator inside the if-clause
    55  */
    56 status = inSection(4);
    57 a = 0;
    58 b = 6;
    59 c = 0;
    60 if (a = 5, b == 6) { c = 1; }
    61 actual = c;
    62 expect = 1;
    63 addThis();
    65 status = inSection(5);
    66 c = 0;
    67 if (1, 1 == 6) { c = 1; }
    68 actual = c;
    69 expect = 0;
    70 addThis();
    73 /*
    74  * Now some tests involving arrays
    75  */
    76 var x=[];
    78 status = inSection(6); // get element case
    79 c = 0;
    80 if (x[1==2]) { c = 1; }
    81 actual = c;
    82 expect = 0;
    83 addThis();
    85 status = inSection(7); // set element case
    86 c = 0;
    87 if (x[1==2]=1) { c = 1; }
    88 actual = c;
    89 expect = 1;
    90 addThis();
    92 status = inSection(8); // delete element case
    93 c = 0;
    94 if (delete x[1==2]) { c = 1; }
    95 actual = c;
    96 expect = 1;
    97 addThis();
   102 //-----------------------------------------------------------------------------
   103 test();
   104 //-----------------------------------------------------------------------------
   109 function addThis()
   110 {
   111   statusitems[UBound] = status;
   112   actualvalues[UBound] = actual;
   113   expectedvalues[UBound] = expect;
   114   UBound++;
   115 }
   118 function test()
   119 {
   120   enterFunc('test');
   121   printBugNumber(BUGNUMBER);
   122   printStatus(summary);
   124   for (var i=0; i<UBound; i++)
   125   {
   126     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
   127   }
   129   exitFunc ('test');
   130 }

mercurial