blob: e5caa0cb322f4a4053a3a4369c840e0fd87ea417 [file] [log] [blame]
Test RegExp#flags accessor
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
property descriptor
PASS descriptor.configurable is true
PASS descriptor.enumerable is false
PASS typeof descriptor.get is 'function'
PASS descriptor.set is undefined
PASS /a/g.flags is 'g'
PASS /a/.flags is ''
PASS /a/gmi.flags is 'gim'
PASS new RegExp('a', 'gmi').flags is 'gim'
PASS flags.call(/a/ig) is 'gi'
non-object receivers
PASS flags.call(undefined) threw exception TypeError: The RegExp.prototype.flags getter can only be called on an object.
PASS flags.call(null) threw exception TypeError: The RegExp.prototype.flags getter can only be called on an object.
PASS flags.call(false) threw exception TypeError: The RegExp.prototype.flags getter can only be called on an object.
PASS flags.call(true) threw exception TypeError: The RegExp.prototype.flags getter can only be called on an object.
non-regex objects
PASS flags.call({}) is ''
PASS flags.call({global: true, multiline: true, ignoreCase: true}) is 'gim'
PASS flags.call({global: 1, multiline: 0, ignoreCase: 2}) is 'gi'
PASS flags.call({ __proto__: { multiline: true } }) is 'm'
unicode flag
PASS /a/uimg.flags is 'gimu'
PASS new RegExp('a', 'uimg').flags is 'gimu'
PASS flags.call({global: true, multiline: true, ignoreCase: true, unicode: true}) is 'gimu'
sticky flag
PASS /a/yimg.flags is 'gimy'
PASS new RegExp('a', 'yimg').flags is 'gimy'
PASS flags.call({global: true, multiline: true, ignoreCase: true, sticky: true}) is 'gimy'
PASS successfullyParsed is true
TEST COMPLETE