487a47e3aaf7bc209de98de3a2697011ce98ae7b
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / parserstress / tests / ecma / SourceText / 6-1.js
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is Mozilla Communicator client code, released
16  * March 31, 1998.
17  *
18  * The Initial Developer of the Original Code is
19  * Netscape Communications Corporation.
20  * Portions created by the Initial Developer are Copyright (C) 1998
21  * the Initial Developer. All Rights Reserved.
22  *
23  * Contributor(s):
24  *
25  * Alternatively, the contents of this file may be used under the terms of
26  * either the GNU General Public License Version 2 or later (the "GPL"), or
27  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28  * in which case the provisions of the GPL or the LGPL are applicable instead
29  * of those above. If you wish to allow use of your version of this file only
30  * under the terms of either the GPL or the LGPL, and not to allow others to
31  * use your version of this file under the terms of the MPL, indicate your
32  * decision by deleting the provisions above and replace them with the notice
33  * and other provisions required by the GPL or the LGPL. If you do not delete
34  * the provisions above, a recipient may use your version of this file under
35  * the terms of any one of the MPL, the GPL or the LGPL.
36  *
37  * ***** END LICENSE BLOCK ***** */
38
39 gTestfile = '6-1.js';
40
41 /**
42    File Name:          6-1.js
43    ECMA Section:       Source Text
44    Description:
45
46    ECMAScript source text is represented as a sequence of characters
47    representable using the Unicode version 2.0 character encoding.
48
49    SourceCharacter ::
50    any Unicode character
51
52    However, it is possible to represent every ECMAScript program using
53    only ASCII characters (which are equivalent to the first 128 Unicode
54    characters). Non-ASCII Unicode characters may appear only within comments
55    and string literals. In string literals, any Unicode character may also be
56    expressed as a Unicode escape sequence consisting of six ASCII characters,
57    namely \u plus four hexadecimal digits. Within a comment, such an escape
58    sequence is effectively ignored as part of the comment. Within a string
59    literal, the Unicode escape sequence contributes one character to the string
60    value of the literal.
61
62    Note that ECMAScript differs from the Java programming language in the
63    behavior of Unicode escape sequences. In a Java program, if the Unicode escape
64    sequence \u000A, for example, occurs within a single-line comment, it is
65    interpreted as a line terminator (Unicode character 000A is line feed) and
66    therefore the next character is not part of the comment. Similarly, if the
67    Unicode escape sequence \u000A occurs within a string literal in a Java
68    program, it is likewise interpreted as a line terminator, which is not
69    allowed within a string literal-one must write \n instead of \u000A to
70    cause a line feed to be part of the string value of a string literal. In
71    an ECMAScript program, a Unicode escape sequence occurring within a comment
72    is never interpreted and therefore cannot contribute to termination of the
73    comment. Similarly, a Unicode escape sequence occurring within a string literal
74    in an ECMAScript program always contributes a character to the string value of
75    the literal and is never interpreted as a line terminator or as a quote mark
76    that might terminate the string literal.
77
78    Author:             christine@netscape.com
79    Date:               12 november 1997
80 */
81
82 var SECTION = "6-1";
83 var VERSION = "ECMA_1";
84 startTest();
85 var TITLE   = "Source Text";
86
87 writeHeaderToLog( SECTION + " "+ TITLE);
88
89 var testcase = new TestCase( SECTION,
90                              "// the following character should not be interpreted as a line terminator in a comment: \u000A",
91                              'PASSED',
92                              "PASSED" );
93
94 // \u000A testcase.actual = "FAILED!";
95
96 testcase =
97   new TestCase( SECTION,
98                 "// the following character should not be interpreted as a line terminator in a comment: \\n 'FAILED'",
99                 'PASSED',
100                 'PASSED' );
101
102 // the following character should noy be interpreted as a line terminator: \\n testcase.actual = "FAILED"
103
104 testcase =
105   new TestCase( SECTION,
106                 "// the following character should not be interpreted as a line terminator in a comment: \\u000A 'FAILED'",
107                 'PASSED',
108                 'PASSED' );
109
110 // the following character should not be interpreted as a line terminator:   \u000A testcase.actual = "FAILED"
111
112 testcase =
113   new TestCase( SECTION,
114                 "// the following character should not be interpreted as a line terminator in a comment: \n 'PASSED'",
115                 'PASSED',
116                 'PASSED' );
117 // the following character should not be interpreted as a line terminator: \n testcase.actual = 'FAILED'
118
119 testcase =
120   new TestCase(   SECTION,
121                   "// the following character should not be interpreted as a line terminator in a comment: u000D",
122                   'PASSED',
123                   'PASSED' );
124
125 // the following character should not be interpreted as a line terminator:   \u000D testcase.actual = "FAILED"
126
127 test();
128