diff options
author | Caio Lima <ticaiolima@gmail.com> | 2017-11-17 00:07:17 -0200 |
---|---|---|
committer | Caio Lima <ticaiolima@gmail.com> | 2017-11-17 00:11:27 -0200 |
commit | 349baebc017ffaea0ecd4c691da5dbce26c440b8 (patch) | |
tree | 86610025efd0ca0aded0ce23f3034f5f19199f98 /test/built-ins/BigInt/constructor-from-string-syntax-errors.js | |
parent | 076ecc38c62f83816d44663f1f96cb5017d72ba8 (diff) | |
download | qtdeclarative-testsuites-349baebc017ffaea0ecd4c691da5dbce26c440b8.tar.gz |
Added missing cases into BigIntConstructor and String parameters
Diffstat (limited to 'test/built-ins/BigInt/constructor-from-string-syntax-errors.js')
-rw-r--r-- | test/built-ins/BigInt/constructor-from-string-syntax-errors.js | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/test/built-ins/BigInt/constructor-from-string-syntax-errors.js b/test/built-ins/BigInt/constructor-from-string-syntax-errors.js new file mode 100644 index 000000000..1ca102602 --- /dev/null +++ b/test/built-ins/BigInt/constructor-from-string-syntax-errors.js @@ -0,0 +1,71 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Invalid String into BigInt constructor should throw SyntaxError +esid: sec-string-to-bigint +info: | + Apply the algorithm in 3.1.3.1 with the following changes: + + - Replace the StrUnsignedDecimalLiteral production with DecimalDigits + to not allow decimal points or exponents. + +features: [BigInt] +---*/ + +assert.throws(SyntaxError, function() { + BigInt("10n"); +} + +assert.throws(SyntaxError, function() { + BigInt("10x"); +} + +assert.throws(SyntaxError, function() { + BigInt("10b"); +} + +assert.throws(SyntaxError, function() { + BigInt("10.5"); +} + +assert.throws(SyntaxError, function() { + BigInt("0b"); +} + +assert.throws(SyntaxError, function() { + BigInt("-0x1"); +} + +assert.throws(SyntaxError, function() { + BigInt("-0XFFab"); +} + +assert.throws(SyntaxError, function() { + BigInt("0oa"); +} + +assert.throws(SyntaxError, function() { + BigInt("000 12"); +} + +assert.throws(SyntaxError, function() { + BigInt("0o"); +} + +assert.throws(SyntaxError, function() { + BigInt("0x"); +} + +assert.throws(SyntaxError, function() { + BigInt("00o"); +} + +assert.throws(SyntaxError, function() { + BigInt("00b"); +} + +assert.throws(SyntaxError, function() { + BigInt("00x"); +} + |