diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js')
-rw-r--r-- | js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js b/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js new file mode 100644 index 0000000000..40b419e1c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-captured-value.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Encoding of `capturedValue` +es6id: 21.2.5.2.2 +info: | + 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S ) + + [...] + 12. Let flags be the value of R’s [[OriginalFlags]] internal slot. + 13. If flags contains "u", let fullUnicode be true, else let fullUnicode be + false. + [...] + 28. For each integer i such that i > 0 and i ≤ n + a. Let captureI be ith element of r's captures List. + b. If captureI is undefined, let capturedValue be undefined. + c. Else if fullUnicode is true, + i. Assert: captureI is a List of code points. + ii. Let capturedValue be a string whose code units are the + UTF16Encoding (10.1.1) of the code points of captureI. + [...] + e. Perform CreateDataProperty(A, ToString(i) , capturedValue). + 29. Return A. +---*/ + +var match = /./u.exec('𝌆'); + +assert(match !== null); +assert.sameValue(match.length, 1); +assert.sameValue(match[0].length, 2); +assert.sameValue(match[0][0], '\ud834'); +assert.sameValue(match[0][1], '\udf06'); + +reportCompare(0, 0); |