2011-09-07 08:35:18 +02:00
|
|
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
|
|
|
info: 1, true, non-empty string in expression is evaluated to true
|
2014-07-25 00:41:42 +02:00
|
|
|
es5id: 12.5_A1_T2
|
2014-07-22 01:09:02 +02:00
|
|
|
description: Using "if/else" construction
|
|
|
|
---*/
|
2011-09-07 08:35:18 +02:00
|
|
|
|
|
|
|
var c=0;
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//CHECK#1
|
|
|
|
if(!(1))
|
2021-07-22 21:58:54 +02:00
|
|
|
throw new Test262Error('#1.1: 1 in expression is evaluated to true');
|
2011-09-07 08:35:18 +02:00
|
|
|
else
|
|
|
|
c++;
|
2021-07-22 21:58:54 +02:00
|
|
|
if (c!=1) throw new Test262Error('#1.2: else branch don`t execute');
|
2011-09-07 08:35:18 +02:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//CHECK#2
|
|
|
|
if(!(true))
|
2021-07-22 21:58:54 +02:00
|
|
|
throw new Test262Error('#2.1: true in expression is evaluated to true');
|
2011-09-07 08:35:18 +02:00
|
|
|
else
|
|
|
|
c++;
|
2021-07-22 21:58:54 +02:00
|
|
|
if (c!=2) throw new Test262Error('#2.2: else branch don`t execute');
|
2011-09-07 08:35:18 +02:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//CHECK#3
|
|
|
|
if(!("1"))
|
2021-07-22 21:58:54 +02:00
|
|
|
throw new Test262Error('#3.1: "1" in expression is evaluated to true');
|
2011-09-07 08:35:18 +02:00
|
|
|
else
|
|
|
|
c++;
|
2021-07-22 21:58:54 +02:00
|
|
|
if (c!=3) throw new Test262Error('#3.2: else branch don`t execute');
|
2011-09-07 08:35:18 +02:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//CHECK#4
|
|
|
|
if(!("A"))
|
2021-07-22 21:58:54 +02:00
|
|
|
throw new Test262Error('#4.1: "A" in expression is evaluated to true');
|
2011-09-07 08:35:18 +02:00
|
|
|
else
|
|
|
|
c++;
|
2021-07-22 21:58:54 +02:00
|
|
|
if (c!=4) throw new Test262Error('#4.2: else branch don`t execute');
|
2011-09-07 08:35:18 +02:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|