cdfe53e38ef70ec6b9f3df505108af0f39cb060f
[mono.git] / mcs / class / Microsoft.JScript / Test / Mozilla / ecma / Expressions / 11.12-4.js
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\r
2 /* ***** BEGIN LICENSE BLOCK *****\r
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
4  *\r
5  * The contents of this file are subject to the Mozilla Public License Version\r
6  * 1.1 (the "License"); you may not use this file except in compliance with\r
7  * the License. You may obtain a copy of the License at\r
8  * http://www.mozilla.org/MPL/\r
9  *\r
10  * Software distributed under the License is distributed on an "AS IS" basis,\r
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
12  * for the specific language governing rights and limitations under the\r
13  * License.\r
14  *\r
15  * The Original Code is Mozilla Communicator client code, released\r
16  * March 31, 1998.\r
17  *\r
18  * The Initial Developer of the Original Code is\r
19  * Netscape Communications Corporation.\r
20  * Portions created by the Initial Developer are Copyright (C) 1998\r
21  * the Initial Developer. All Rights Reserved.\r
22  *\r
23  * Contributor(s):\r
24  *\r
25  * Alternatively, the contents of this file may be used under the terms of\r
26  * either the GNU General Public License Version 2 or later (the "GPL"), or\r
27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),\r
28  * in which case the provisions of the GPL or the LGPL are applicable instead\r
29  * of those above. If you wish to allow use of your version of this file only\r
30  * under the terms of either the GPL or the LGPL, and not to allow others to\r
31  * use your version of this file under the terms of the MPL, indicate your\r
32  * decision by deleting the provisions above and replace them with the notice\r
33  * and other provisions required by the GPL or the LGPL. If you do not delete\r
34  * the provisions above, a recipient may use your version of this file under\r
35  * the terms of any one of the MPL, the GPL or the LGPL.\r
36  *\r
37  * ***** END LICENSE BLOCK ***** */\r
38 \r
39 /**\r
40    File Name:          11.12-4.js\r
41    ECMA Section:       11.12\r
42    Description:\r
43 \r
44    The grammar for a ConditionalExpression in ECMAScript is a little bit\r
45    different from that in C and Java, which each allow the second\r
46    subexpression to be an Expression but restrict the third expression to\r
47    be a ConditionalExpression.  The motivation for this difference in\r
48    ECMAScript is to allow an assignment expression to be governed by either\r
49    arm of a conditional and to eliminate the confusing and fairly useless\r
50    case of a comma expression as the center expression.\r
51 \r
52    Author:             christine@netscape.com\r
53    Date:               12 november 1997\r
54 */\r
55 \r
56 var SECTION = "11.12-4";\r
57 var VERSION = "ECMA_1";\r
58 startTest();\r
59 writeHeaderToLog( SECTION + " Conditional operator ( ? : )");\r
60 \r
61 // the following expression should NOT be an error in JS.\r
62 \r
63 new TestCase( SECTION,\r
64               "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1",\r
65               "PASSED",\r
66               eval("true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1") );\r
67 \r
68 test();\r
69 \r