diff options
author | André Bargull <andre.bargull@gmail.com> | 2015-08-06 17:50:08 +0200 |
---|---|---|
committer | André Bargull <andre.bargull@gmail.com> | 2015-09-07 17:25:55 +0200 |
commit | df9bf58204c21f7b1bfb0a13a73226949fbe1fed (patch) | |
tree | d28fc2f40a0f5e939e4b7135d37f10af53aecb89 /test/built-ins/RegExp | |
parent | 03d2f68c9c185970a9b7cee5806e8733188db360 (diff) | |
download | qtdeclarative-testsuites-df9bf58204c21f7b1bfb0a13a73226949fbe1fed.tar.gz |
Tests for changes introduced in ES2015 (Annex E)
- String case functions iterate over code points
- Has called before Get in Array.p.reverse
- Add test for web-compat Array.p.splice behaviour; Plus missing test for no arguments case
- ToObject no longer applied to this-value in Array.p.toLocaleString
- ToObject no longer applied to this-value in Object.p.toLocaleString
- Add tests for Object.p.propertyIsEnumerable and symbol property keys
- Add tests for Object.p.hasOwnProperty and symbol property keys
- Test property descriptor attributes of message property
- Tests for RegExp constructor checks
- Date constructor when called with date object
- TimeClip never returns negative zero
Diffstat (limited to 'test/built-ins/RegExp')
3 files changed, 70 insertions, 0 deletions
diff --git a/test/built-ins/RegExp/call_with_non_regexp_same_constructor.js b/test/built-ins/RegExp/call_with_non_regexp_same_constructor.js new file mode 100755 index 000000000..6a380bcca --- /dev/null +++ b/test/built-ins/RegExp/call_with_non_regexp_same_constructor.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: RegExp returns its input argument if constructor is same-value +info: > + 21.2.3.1 RegExp ( pattern, flags ) + + ... + 4. Else, + a. Let newTarget be the active function object. + b. If patternIsRegExp is true and flags is undefined, then + i. Let patternConstructor be Get(pattern, "constructor"). + ii. ReturnIfAbrupt(patternConstructor). + iii. If SameValue(newTarget, patternConstructor) is true, return pattern. +es6id: 21.2.3.1 +features: [Symbol.match] +---*/ + +var obj = { + constructor: RegExp +}; +obj[Symbol.match] = true; + +assert.sameValue(RegExp(obj), obj, "RegExp returns its input argument"); diff --git a/test/built-ins/RegExp/call_with_regexp_match_falsy.js b/test/built-ins/RegExp/call_with_regexp_match_falsy.js new file mode 100755 index 000000000..77ae92e3b --- /dev/null +++ b/test/built-ins/RegExp/call_with_regexp_match_falsy.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: RegExp returns a new object if constructor is not same-value +info: > + 21.2.3.1 RegExp ( pattern, flags ) + + ... + 4. Else, + a. Let newTarget be the active function object. + b. If patternIsRegExp is true and flags is undefined, then + i. Let patternConstructor be Get(pattern, "constructor"). + ii. ReturnIfAbrupt(patternConstructor). + iii. If SameValue(newTarget, patternConstructor) is true, return pattern. +es6id: 21.2.3.1 +features: [Symbol.match] +---*/ + +var regExpObj = /(?:)/; +regExpObj[Symbol.match] = false; + +assert.notSameValue(RegExp(regExpObj), regExpObj, "RegExp returns new object"); diff --git a/test/built-ins/RegExp/call_with_regexp_not_same_constructor.js b/test/built-ins/RegExp/call_with_regexp_not_same_constructor.js new file mode 100755 index 000000000..b2eee3cd8 --- /dev/null +++ b/test/built-ins/RegExp/call_with_regexp_not_same_constructor.js @@ -0,0 +1,22 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: RegExp returns a new object if constructor is not same-value +info: > + 21.2.3.1 RegExp ( pattern, flags ) + + ... + 4. Else, + a. Let newTarget be the active function object. + b. If patternIsRegExp is true and flags is undefined, then + i. Let patternConstructor be Get(pattern, "constructor"). + ii. ReturnIfAbrupt(patternConstructor). + iii. If SameValue(newTarget, patternConstructor) is true, return pattern. +es6id: 21.2.3.1 +---*/ + +var regExpObj = /(?:)/; +regExpObj.constructor = null; + +assert.notSameValue(RegExp(regExpObj), regExpObj, "RegExp returns new object"); |