Add coverage for Legacy RegExp features
leobalter opened this issue · 2 comments
leobalter commented
currently on stage 3
jugglinmike commented
@leobalter I think this issue was mistakenly closed--Test262 lacks coverage for most of this proposal.
$ git show -s '--format=%h %ci %s' HEAD
32bb36f5e4 2019-09-26 14:28:56 -0400 Tests for TLA module evaluation
$ git grep lastMatch test
$ git grep lastParen test
$ git grep leftContext test
$ git grep rightContext test
Naive queries for the other properties return some false positives, but they also appear to be untested
$ git grep '[^#]\$_' test
test/language/identifiers/start-dollar-sign.js:var $_ = 4;
test/language/identifiers/start-dollar-sign.js:assert.sameValue($_, 4);
test/language/identifiers/start-escape-seq.js:assert.sameValue($_, 6);
$ git grep '\$&' test
test/built-ins/RegExp/prototype/Symbol.replace/result-coerce-matched.js: r[Symbol.replace]('', 'foo[$&]bar'), 'foo[toString value]bar'
test/built-ins/RegExp/prototype/Symbol.replace/subst-matched.js: Unicode Characters: $&
test/built-ins/RegExp/prototype/Symbol.replace/subst-matched.js:assert.sameValue(/.4?./[Symbol.replace]('abc', '[$&]'), '[ab]c');
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T3.js:description: Use $& in replaceValue, searchValue is regular expression /sh/g
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T3.js:if (__str.replace(__re, "$&" + 'sch') !== 'She sells seashschells by the seashschore.') {
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T3.js: $ERROR('#1: var __str = \'She sells seashells by the seashore.\'; var __re = /sh/g; __str.replace(__re,"$&" + \'sch\')===\'She sells seashschells by the seashschore.\'. Actual: ' + __str.replace(__re, "$&" + 'sch'));
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T8.js:description: Use $& in replaceValue, searchValue is regular expression /sh/
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T8.js:if (__str.replace(__re, "$&" + 'sch') !== 'She sells seashschells by the seashore.') {
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T8.js: $ERROR('#1: var __str = \'She sells seashells by the seashore.\'; var __re = /sh/; __str.replace(__re, "$&" + \'sch\')===\'She sells seashschells by the seashore.\'. Actual: ' + __str.replace(__re, "$&" + 'sch'));
$ git grep '\$+' test
test/language/identifiers/part-digits-via-escape-hex.js:description: Identifier is $+ANY_DIGIT
test/language/identifiers/part-digits-via-escape-hex4.js:description: Identifier is $+ANY_DIGIT
test/language/identifiers/part-digits.js:description: Identifier is $+ANY_DIGIT
$ git grep '\$`' test
test/built-ins/RegExp/prototype/Symbol.replace/subst-before.js: Unicode Characters: $`
test/built-ins/RegExp/prototype/Symbol.replace/subst-before.js:assert.sameValue(/a/[Symbol.replace]('abc', '[$`]'), '[]bc');
test/built-ins/RegExp/prototype/Symbol.replace/subst-before.js:assert.sameValue(/b/[Symbol.replace]('abc', '[$`]'), 'a[a]c');
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T4.js:description: Use $` in replaceValue, searchValue is regular expression /sh/g
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T4.js:if (__str.replace(__re, "$`" + 'sch') !== 'She sells seaShe sells seaschells by the seaShe sells seashells by the seaschore.') {
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T4.js: $ERROR('#1: var __str = \'She sells seashells by the seashore.\'; var __re = /sh/g; __str.replace(__re, "$`" + \'sch\')===\'She sells seaShe sells seaschells by the seaShe sells seashells by the seaschore.\'. Actual: ' + __str.replace(__re, "$`" + 'sch'));
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T9.js:description: Use $` in replaceValue, searchValue is regular expression /sh/
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T9.js:if (__str.replace(__re, "$`" + 'sch') !== 'She sells seaShe sells seaschells by the seashore.') {
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T9.js: $ERROR('#1: var __str = \'She sells seashells by the seashore.\'; var __re = /sh/; __str.replace(__re, "$`" + \'sch\')===\'She sells seaShe sells seaschells by the seashore.\'. Actual: ' + __str.replace(__re, "$`" + 'sch'));
test/language/expressions/template-literal/tv-template-character.js: assert.sameValue(s[0], '$', '`$` character TV');
test/language/expressions/template-literal/tv-template-character.js: assert.sameValue(s.raw[0], '$', '`$` character TRV');
test/language/expressions/template-literal/tv-template-character.js:})`$`;
$ git grep '$'\''' test
test/built-ins/RegExp/prototype/Symbol.replace/subst-after.js: Unicode Characters: $'
test/built-ins/RegExp/prototype/Symbol.replace/subst-dollar.js:assert.sameValue(/./[Symbol.replace]('abc', '$$'), '$bc', '"escaped" version');
test/built-ins/RegExp/prototype/Symbol.replace/subst-dollar.js: /./[Symbol.replace]('abc', '$'), '$bc', '"unescaped" version'
test/built-ins/RegExp/prototype/Symbol.replace/subst-dollar.js: /./[Symbol.replace]('abc', '\\$'), '\\$bc', 'backslash-prefixed'
test/built-ins/RegExp/prototype/Symbol.replace/subst-dollar.js: /./[Symbol.replace]('abc', '$$$'),
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T10.js:description: Use $' in replaceValue, searchValue is regular expression /sh/
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T10.js:if (__str.replace(__re, "$'" + 'sch') !== 'She sells seaells by the seashore.schells by the seashore.') {
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T10.js: $ERROR('#1: var __str = \'She sells seashells by the seashore.\'; var __re = /sh/; __str.replace(__re, "$\'" + \'sch\')===\'She sells seaells by the seashore.schells by the seashore.\'. Actual: ' + __str.replace(__re, "$'" + 'sch'));
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T5.js:description: Use $' in replaceValue, searchValue is regular expression /sh/g
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T5.js:if (__str.replace(__re, "$'" + 'sch') !== 'She sells seaells by the seashore.schells by the seaore.schore.') {
test/built-ins/String/prototype/replace/S15.5.4.11_A2_T5.js: $ERROR('#1: var __str = \'She sells seashells by the seashore.\'; var __re = /sh/g; __str.replace(__re, "$\'" + \'sch\')===\'She sells seaells by the seashore.schells by the seaore.schore.\'. Actual: ' + __str.replace(__re, "$'" + 'sch'));
test/language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js: assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"');
test/language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js: assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"');
test/language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js: assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"');
test/language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js: assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"');
test/language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js: assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"');
test/language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js: assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"');
test/language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js: assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"');
test/language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js: assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"');
test/language/expressions/template-literal/tv-template-character.js: assert.sameValue(s[0], '$', '`$` character TV');
test/language/expressions/template-literal/tv-template-character.js: assert.sameValue(s.raw[0], '$', '`$` character TRV');
test/language/module-code/namespace/internals/own-property-keys-sort.js:assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"');
test/language/module-code/namespace/internals/own-property-keys-sort.js:assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"');
test/language/module-code/namespace/internals/own-property-keys-sort.js:assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"');
test/language/module-code/namespace/internals/own-property-keys-sort.js:assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"');
$ git grep -E '['\''".]\$[0-9]\b' test
test/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js: ("$1" property of the RegExp built-in)
test/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js:Reflect.defineProperty(RegExp, '$1', {
test/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js:var desc = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
test/built-ins/Object/internals/DefineOwnProperty/consistent-value-regexp-dollar1.js: var desc2 = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
test/built-ins/Object/internals/DefineOwnProperty/consistent-writable-regexp-dollar1.js: ("$1" property of the RegExp built-in)
test/built-ins/Object/internals/DefineOwnProperty/consistent-writable-regexp-dollar1.js:if (Reflect.defineProperty(RegExp, '$1', {
test/built-ins/Object/internals/DefineOwnProperty/consistent-writable-regexp-dollar1.js: var desc = Reflect.getOwnPropertyDescriptor(RegExp, '$1');
test/built-ins/RegExp/S15.10.2.8_A3_T18.js:var __replaced = "To sign up click |here|https:www.xxxx.org/subscribe.htm|".replace(/(\|)([\w\x81-\xff ]*)(\|)([\/a-z][\w:\/\.]*\.[a-z]{3,4})(\|)/ig, '<a href="$4">$2</a>');
test/built-ins/RegExp/S15.10.2.8_A3_T18.js: $ERROR('#1: __replaced = "To sign up click |here|https:www.xxxx.org/subscribe.htm|".replace(/(\\|)([\\w\\x81-\\xff ]*)(\\|)([\\/a-z][\\w:\\/\\.]*\\.[a-z]{3,4})(\\|)/ig, \'<a href="$4">$2</a>\'); __replaced === ' + __expected + '. Actual: ' + __replaced);
test/built-ins/RegExp/named-groups/string-replace-nocaptures.js: assert.sameValue("bacd", "abcd".replace(re, "$2$1"));
test/built-ins/RegExp/named-groups/string-replace-nocaptures.js: assert.sameValue("cd", "abcd".replace(re, "$3"));
test/built-ins/RegExp/named-groups/string-replace-numbered.js: assert.sameValue("badc", "abcd".replace(re, "$2$1"));
test/built-ins/RegExp/named-groups/string-replace-numbered.js: assert.sameValue("bacd", "abcd".replace(re, "$2$1"));
test/built-ins/RegExp/prototype/Symbol.replace/result-coerce-length.js:assert.sameValue(r[Symbol.replace]('', '$1$2$3'), 'foobar$3');
test/built-ins/String/prototype/replace/S15.5.4.11_A5_T1.js:description: searchValue is regexp /^(a+)\1*,\1+$/ and replaceValue is "$1"
test/built-ins/String/prototype/replace/S15.5.4.11_A5_T1.js:var __repl = "$1";
test/built-ins/String/prototype/replace/S15.5.4.11_A5_T1.js: $ERROR('#1: var __str = "aaaaaaaaaa,aaaaaaaaaaaaaaa"; var __pattern = /^(a+)\\1*,\\1+$/; var __repl = "$1"; __str.replace(__pattern, __repl)===\'aaaaa\'. Actual: ' + __str.replace(__pattern, __repl));
test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js: "$0.00",
test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js: "$0.00",
/cc @claudepache @erights