Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/annexB/built-ins/unescape/four-ignore-non-hex.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-unescape-string
5 es6id: B.2.1.2
6 description: >
7 Does not transform four-character patterns that contain non-hexadecimal
8 digits
9 info: |
10 [...]
11 5. Repeat, while k ≠ length,
12 [...]
13 a. Let c be the code unit at index k within string.
14 b. If c is %, then
15 i. If k ≤ length-6 and the code unit at index k+1 within string is u
16 and the four code units at indices k+2, k+3, k+4, and k+5 within
17 string are all hexadecimal digits, then
18 1. Let c be the code unit whose value is the integer represented
19 by the four hexadecimal digits at indices k+2, k+3, k+4, and
20 k+5 within string.
21 2. Increase k by 5.
22 [...]
23 ---*/
24
25 assert.sameValue(unescape('%u000%0'), '%u000%0');
26
27 assert.sameValue(unescape('%u000g0'), '%u000g0');
28 assert.sameValue(unescape('%u000G0'), '%u000G0');
29 assert.sameValue(unescape('%u00g00'), '%u00g00');
30 assert.sameValue(unescape('%u00G00'), '%u00G00');
31 assert.sameValue(unescape('%u0g000'), '%u0g000');
32 assert.sameValue(unescape('%u0G000'), '%u0G000');
33 assert.sameValue(unescape('%ug0000'), '%ug0000');
34 assert.sameValue(unescape('%uG0000'), '%uG0000');
35
36 assert.sameValue(unescape('%u000u0'), '%u000u0');
37 assert.sameValue(unescape('%u000U0'), '%u000U0');
38 assert.sameValue(unescape('%u00u00'), '%u00u00');
39 assert.sameValue(unescape('%u00U00'), '%u00U00');
40 assert.sameValue(unescape('%u0u000'), '%u0u000');
41 assert.sameValue(unescape('%u0U000'), '%u0U000');
42 assert.sameValue(unescape('%uu0000'), '%uu0000');
43 assert.sameValue(unescape('%uU0000'), '%uU0000');