1/* Copyright JS Foundation and other contributors, http://js.foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16function checkSyntaxError (str) {
17  try {
18    eval (str);
19    assert (false);
20  } catch (e) {
21    assert (e instanceof SyntaxError);
22  }
23}
24
25checkSyntaxError ("0p");
26checkSyntaxError ("0o");
27checkSyntaxError ("0o0123456789");
28checkSyntaxError ("0o9");
29
30checkSyntaxError ("0p");
31checkSyntaxError ("0O");
32checkSyntaxError ("0O9");
33
34// Check strict mode
35checkSyntaxError ("'use strict'; 0777");
36assert (eval ("'use strict'; 0o777") === 511);
37
38assert (0o123 === 83);
39assert (0o77777777 === 16777215);
40assert (0o767 === parseInt ("767", 8));
41assert (0767 === 0o767);
42
43assert (0O123 === 83);
44assert (0O77777777 === 16777215);
45assert (0O767 === parseInt ("767", 8));
46assert (0767 === 0O767);
47