two-ignore-non-hex.js (1269B)
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 two-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 [...] 16 ii. Else if k ≤ length-3 and the two code units at indices k+1 and 17 k+2 within string are both hexadecimal digits, then 18 1. Let c be the code unit whose value is the integer represented 19 by two zeroes plus the two hexadecimal digits at indices k+1 20 and k+2 within string. 21 2. Increase k by 2. 22 [...] 23 ---*/ 24 25 assert.sameValue(unescape('%0%0'), '%0%0'); 26 27 assert.sameValue(unescape('%0g0'), '%0g0'); 28 assert.sameValue(unescape('%0G0'), '%0G0'); 29 assert.sameValue(unescape('%g00'), '%g00'); 30 assert.sameValue(unescape('%G00'), '%G00'); 31 32 assert.sameValue(unescape('%0u0'), '%0u0'); 33 assert.sameValue(unescape('%0U0'), '%0U0'); 34 assert.sameValue(unescape('%u00'), '%u00'); 35 assert.sameValue(unescape('%U00'), '%U00'); 36 37 reportCompare(0, 0);