string-octal-literal-invald.js (969B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 es6id: 20.1.1.1 6 description: Invalid octal literals yield NaN 7 info: | 8 OctalIntegerLiteral :: 9 0o OctalDigits 10 0O OctalDigits 11 OctalDigits :: 12 OctalDigit 13 OctalDigits OctalDigit 14 OctalDigit :: one of 15 0 1 2 3 4 5 6 7 16 ---*/ 17 18 assert.sameValue(Number('0o8'), NaN, 'invalid digit'); 19 assert.sameValue(Number('00o0'), NaN, 'leading zero'); 20 assert.sameValue(Number('0o'), NaN, 'omitted digits'); 21 assert.sameValue(Number('+0o10'), NaN, 'plus sign'); 22 assert.sameValue(Number('-0o10'), NaN, 'minus sign'); 23 assert.sameValue(Number('0o10.01'), NaN, 'fractional part'); 24 assert.sameValue(Number('0o1e10'), NaN, 'exponent part'); 25 assert.sameValue(Number('0o1e-10'), NaN, 'exponent part with a minus sign'); 26 assert.sameValue(Number('0o1e+10'), NaN, 'exponent part with a plus sign'); 27 28 reportCompare(0, 0);