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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_5/Regress/regress-321757.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,109 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +//-----------------------------------------------------------------------------
    1.10 +var BUGNUMBER = 321757;
    1.11 +var summary = 'Compound assignment operators should not bind LHS';
    1.12 +var actual = '';
    1.13 +var expect = 'pass';
    1.14 +
    1.15 +printBugNumber(BUGNUMBER);
    1.16 +printStatus (summary);
    1.17 +
    1.18 +try
    1.19 +{
    1.20 +  foo += 1;
    1.21 +  actual = "fail";
    1.22 +}
    1.23 +catch (e)
    1.24 +{
    1.25 +  actual = "pass";
    1.26 +}
    1.27 + 
    1.28 +reportCompare(expect, actual, summary + ': +=');
    1.29 +
    1.30 +try
    1.31 +{
    1.32 +  foo -= 1;
    1.33 +  actual = "fail";
    1.34 +}
    1.35 +catch (e)
    1.36 +{
    1.37 +  actual = "pass";
    1.38 +}
    1.39 + 
    1.40 +reportCompare(expect, actual, summary + ': -=');
    1.41 +
    1.42 +try
    1.43 +{
    1.44 +  foo *= 1;
    1.45 +  actual = "fail";
    1.46 +}
    1.47 +catch (e)
    1.48 +{
    1.49 +  actual = "pass";
    1.50 +}
    1.51 + 
    1.52 +reportCompare(expect, actual, summary + ': *=');
    1.53 +
    1.54 +try
    1.55 +{
    1.56 +  foo /= 1;
    1.57 +  actual = "fail";
    1.58 +}
    1.59 +catch (e)
    1.60 +{
    1.61 +  actual = "pass";
    1.62 +}
    1.63 + 
    1.64 +reportCompare(expect, actual, summary + ': /=');
    1.65 +
    1.66 +try
    1.67 +{
    1.68 +  foo %= 1;
    1.69 +  actual = "fail";
    1.70 +}
    1.71 +catch (e)
    1.72 +{
    1.73 +  actual = "pass";
    1.74 +}
    1.75 + 
    1.76 +reportCompare(expect, actual, summary + ': %=');
    1.77 +
    1.78 +try
    1.79 +{
    1.80 +  foo <<= 1;
    1.81 +  actual = "fail";
    1.82 +}
    1.83 +catch (e)
    1.84 +{
    1.85 +  actual = "pass";
    1.86 +}
    1.87 + 
    1.88 +reportCompare(expect, actual, summary + ': <<=');
    1.89 +
    1.90 +try
    1.91 +{
    1.92 +  foo >>= 1;
    1.93 +  actual = "fail";
    1.94 +}
    1.95 +catch (e)
    1.96 +{
    1.97 +  actual = "pass";
    1.98 +}
    1.99 + 
   1.100 +reportCompare(expect, actual, summary + ': >>=');
   1.101 +
   1.102 +try
   1.103 +{
   1.104 +  foo >>>= 1;
   1.105 +  actual = "fail";
   1.106 +}
   1.107 +catch (e)
   1.108 +{
   1.109 +  actual = "pass";
   1.110 +}
   1.111 + 
   1.112 +reportCompare(expect, actual, summary + ': >>>=');

mercurial