diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/flags/coercion-dotall.js')
-rw-r--r-- | js/src/tests/test262/built-ins/RegExp/prototype/flags/coercion-dotall.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/flags/coercion-dotall.js b/js/src/tests/test262/built-ins/RegExp/prototype/flags/coercion-dotall.js new file mode 100644 index 0000000000..7b6afe6f54 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/flags/coercion-dotall.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Aleksey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-regexp.prototype.flags +description: Boolean coercion of the dotAll property +info: | + get RegExp.prototype.flags + + ... + 10. Let dotAll be ToBoolean(? Get(R, "dotAll")). + ... +features: [Symbol, regexp-dotall] +---*/ + +var get = Object.getOwnPropertyDescriptor(RegExp.prototype, "flags").get; + +var r = {}; + +r.dotAll = undefined; +assert.sameValue(get.call(r), "", "dotAll: undefined"); + +r.dotAll = null; +assert.sameValue(get.call(r), "", "dotAll: null"); + +r.dotAll = NaN; +assert.sameValue(get.call(r), "", "dotAll: NaN"); + +r.dotAll = ""; +assert.sameValue(get.call(r), "", "dotAll: the empty string"); + +r.dotAll = "string"; +assert.sameValue(get.call(r), "s", "dotAll: string"); + +r.dotAll = 86; +assert.sameValue(get.call(r), "s", "dotAll: 86"); + +r.dotAll = Symbol(); +assert.sameValue(get.call(r), "s", "dotAll: Symbol()"); + +r.dotAll = []; +assert.sameValue(get.call(r), "s", "dotAll: []"); + +r.dotAll = {}; +assert.sameValue(get.call(r), "s", "dotAll: {}"); + +reportCompare(0, 0); |