| 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 are interrupted by the end |
| 8 |
of the string |
| 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('%'), '%'); |
| 26 |
assert.sameValue(unescape('%0'), '%0'); |
| 27 |
assert.sameValue(unescape('%1'), '%1'); |
| 28 |
assert.sameValue(unescape('%2'), '%2'); |
| 29 |
assert.sameValue(unescape('%3'), '%3'); |
| 30 |
assert.sameValue(unescape('%4'), '%4'); |
| 31 |
assert.sameValue(unescape('%5'), '%5'); |
| 32 |
assert.sameValue(unescape('%6'), '%6'); |
| 33 |
assert.sameValue(unescape('%7'), '%7'); |
| 34 |
assert.sameValue(unescape('%8'), '%8'); |
| 35 |
assert.sameValue(unescape('%9'), '%9'); |
| 36 |
assert.sameValue(unescape('%a'), '%a'); |
| 37 |
assert.sameValue(unescape('%A'), '%A'); |
| 38 |
assert.sameValue(unescape('%b'), '%b'); |
| 39 |
assert.sameValue(unescape('%B'), '%B'); |
| 40 |
assert.sameValue(unescape('%c'), '%c'); |
| 41 |
assert.sameValue(unescape('%C'), '%C'); |
| 42 |
assert.sameValue(unescape('%d'), '%d'); |
| 43 |
assert.sameValue(unescape('%D'), '%D'); |
| 44 |
assert.sameValue(unescape('%e'), '%e'); |
| 45 |
assert.sameValue(unescape('%E'), '%E'); |
| 46 |
assert.sameValue(unescape('%f'), '%f'); |
| 47 |
assert.sameValue(unescape('%F'), '%F'); |