four-ignore-bad-u.js (1117B)
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 are not prefixed with the 8 character "u" 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('%U0000'), '%U0000'); 26 assert.sameValue(unescape('%t0000'), '%t0000'); 27 assert.sameValue(unescape('%v0000'), '%v0000'); 28 assert.sameValue(unescape('%%0000'), '%\x0000'); 29 30 reportCompare(0, 0);