OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 shouldBe('window.atob("YQ==")', '"a"'); | 8 shouldBeEqualToString('window.atob("YQ==")', 'a'); |
9 shouldBe('window.atob("YWI=")', '"ab"'); | 9 shouldBeEqualToString('window.atob("YWI=")', 'ab'); |
10 shouldBe('window.atob("YWJj")', '"abc"'); | 10 shouldBeEqualToString('window.atob("YWJj")', 'abc'); |
11 shouldBe('window.atob("YWJjZA==")', '"abcd"'); | 11 shouldBeEqualToString('window.atob("YWJjZA==")', 'abcd'); |
12 shouldBe('window.atob("YWJjZGU=")', '"abcde"'); | 12 shouldBeEqualToString('window.atob("YWJjZGU=")', 'abcde'); |
13 shouldBe('window.atob("YWJjZGVm")', '"abcdef"'); | 13 shouldBeEqualToString('window.atob("YWJjZGVm")', 'abcdef'); |
14 shouldBe('window.btoa("a")', '"YQ=="'); | |
15 shouldBe('window.btoa("ab")', '"YWI="'); | |
16 shouldBe('window.btoa("abc")', '"YWJj"'); | |
17 shouldBe('window.btoa("abcd")', '"YWJjZA=="'); | |
18 shouldBe('window.btoa("abcde")', '"YWJjZGU="'); | |
19 shouldBe('window.btoa("abcdef")', '"YWJjZGVm"'); | |
20 | 14 |
21 shouldBe('typeof window.btoa', '"function"'); | 15 shouldBeEqualToString('window.btoa("a")', 'YQ=='); |
| 16 shouldBeEqualToString('window.btoa("ab")', 'YWI='); |
| 17 shouldBeEqualToString('window.btoa("abc")', 'YWJj'); |
| 18 shouldBeEqualToString('window.btoa("abcd")', 'YWJjZA=='); |
| 19 shouldBeEqualToString('window.btoa("abcde")', 'YWJjZGU='); |
| 20 shouldBeEqualToString('window.btoa("abcdef")', 'YWJjZGVm'); |
| 21 |
| 22 shouldBeEqualToString('typeof window.btoa', 'function'); |
22 shouldThrow('window.btoa()', '"TypeError: Failed to execute \'btoa\' on \'Window
\': 1 argument required, but only 0 present."'); | 23 shouldThrow('window.btoa()', '"TypeError: Failed to execute \'btoa\' on \'Window
\': 1 argument required, but only 0 present."'); |
23 shouldBe('window.btoa("")', '""'); | 24 shouldBeEqualToString('window.btoa("")', ''); |
24 shouldBe('window.btoa(null)', '"bnVsbA=="'); // Gets converted to "null" string. | 25 shouldBeEqualToString('window.btoa(null)', 'bnVsbA=='); // Gets converted to "nu
ll" string. |
25 shouldBe('window.btoa(undefined)', '"dW5kZWZpbmVk"'); | 26 shouldBeEqualToString('window.btoa(undefined)', 'dW5kZWZpbmVk'); |
26 shouldBe('window.btoa(window)', '"W29iamVjdCBXaW5kb3dd"'); // "[object Window]" | 27 shouldBeEqualToString('window.btoa(window)', 'W29iamVjdCBXaW5kb3dd'); // "[objec
t Window]" |
27 shouldBe('window.btoa("éé")', '"6ek="'); | 28 shouldBeEqualToString('window.btoa("éé")', '6ek='); |
28 shouldBe('window.btoa("\\u0080\\u0081")', '"gIE="'); | 29 shouldBeEqualToString('window.btoa("\\u0080\\u0081")', 'gIE='); |
29 shouldThrow('window.btoa("тест")'); | 30 shouldThrow('window.btoa("тест")'); |
30 window.btoa = 0; | 31 window.btoa = 0; |
31 shouldBe('window.btoa', '0'); | 32 shouldBe('window.btoa', '0'); |
32 shouldBe('typeof window.btoa', '"number"'); | 33 shouldBeEqualToString('typeof window.btoa', 'number'); |
33 | 34 |
34 shouldBe('typeof window.atob', '"function"'); | 35 shouldBeEqualToString('typeof window.atob', 'function'); |
35 shouldThrow('window.atob()', '"TypeError: Failed to execute \'atob\' on \'Window
\': 1 argument required, but only 0 present."'); | 36 shouldThrow('window.atob()', '"TypeError: Failed to execute \'atob\' on \'Window
\': 1 argument required, but only 0 present."'); |
36 shouldBe('window.atob("")', '""'); | 37 shouldBeEqualToString('window.atob("")', ''); |
37 shouldBe('window.atob(null)', '"\x9Eée"'); // Gets converted to "null" string. | 38 shouldBeEqualToString('window.atob(null)', '\x9Eée'); // Gets converted to "null
" string. |
38 shouldThrow('window.atob(undefined)'); | 39 shouldThrow('window.atob(undefined)'); |
39 shouldThrow('window.atob(" YQ==")'); | 40 |
40 shouldThrow('window.atob("YQ==\\u000a")'); | 41 // HTML space characters in input. |
41 shouldBe('window.atob("6ek=")', '"éé"'); | 42 shouldBeEqualToString('window.atob(" YQ==")', 'a'); |
42 shouldBe('window.atob("6ek")', '"éé"'); | 43 shouldBeEqualToString('window.atob("YQ== ")', 'a'); |
43 shouldBe('window.atob("gIE=")', '"\u0080\u0081"'); | 44 shouldBeEqualToString('window.atob("YQ== ")', 'a'); |
| 45 shouldBeEqualToString('window.atob("YQ==\\u000a")', 'a'); |
| 46 shouldBeEqualToString('window.atob("YQ ==")', 'a'); |
| 47 shouldBeEqualToString('window.atob("YQ\\t==")', 'a'); |
| 48 shouldBeEqualToString('window.atob("YQ\\n==")', 'a'); |
| 49 shouldBeEqualToString('window.atob("YQ\\f==")', 'a'); |
| 50 shouldBeEqualToString('window.atob("YQ\\r==")', 'a'); |
| 51 shouldBeEqualToString('window.atob("YQ\\t\\n\\f\\r ==")', 'a'); |
| 52 |
| 53 shouldBeEqualToString('window.atob("6ek=")', 'éé'); |
| 54 shouldBeEqualToString('window.atob("6ek")', 'éé'); |
| 55 shouldBeEqualToString('window.atob("gIE=")', '\u0080\u0081'); |
44 shouldThrow('window.atob("тест")'); | 56 shouldThrow('window.atob("тест")'); |
45 shouldThrow('window.atob("z")'); | 57 shouldThrow('window.atob("z")'); |
46 shouldBe('window.atob("zz")', '"Ï"'); | 58 shouldBeEqualToString('window.atob("zz")', 'Ï'); |
47 shouldBe('window.atob("zzz")', '"Ï\u003C"'); | 59 shouldBeEqualToString('window.atob("zzz")', 'Ï\u003C'); |
48 shouldBe('window.atob("zzz=")', '"Ï\u003C"'); | 60 shouldBeEqualToString('window.atob("zzz=")', 'Ï\u003C'); |
49 shouldThrow('window.atob("zzz==")'); // excess pad characters. | 61 shouldThrow('window.atob("zzz==")'); // excess pad characters. |
50 shouldThrow('window.atob("zzz===")'); // excess pad characters. | 62 shouldThrow('window.atob("zzz===")'); // excess pad characters. |
51 shouldThrow('window.atob("zzz====")'); // excess pad characters. | 63 shouldThrow('window.atob("zzz====")'); // excess pad characters. |
52 shouldThrow('window.atob("zzz=====")'); // excess pad characters. | 64 shouldThrow('window.atob("zzz=====")'); // excess pad characters. |
53 shouldBe('window.atob("zzzz")', '"Ï\u003Có"'); | 65 shouldBeEqualToString('window.atob("zzzz")', 'Ï\u003Có'); |
54 shouldThrow('window.atob("zzzzz")'); | 66 shouldThrow('window.atob("zzzzz")'); |
55 shouldThrow('window.atob("z=zz")'); | 67 shouldThrow('window.atob("z=zz")'); |
56 shouldThrow('window.atob("=")'); | 68 shouldThrow('window.atob("=")'); |
57 shouldThrow('window.atob("==")'); | 69 shouldThrow('window.atob("==")'); |
58 shouldThrow('window.atob("===")'); | 70 shouldThrow('window.atob("===")'); |
59 shouldThrow('window.atob("====")'); | 71 shouldThrow('window.atob("====")'); |
60 shouldThrow('window.atob("=====")'); | 72 shouldThrow('window.atob("=====")'); |
61 window.atob = 0; | 73 window.atob = 0; |
62 shouldBe('window.atob', '0'); | 74 shouldBe('window.atob', '0'); |
63 shouldBe('typeof window.atob', '"number"'); | 75 shouldBeEqualToString('typeof window.atob', 'number'); |
64 | 76 |
65 </script> | 77 </script> |
66 </body> | 78 </body> |
67 </html> | 79 </html> |
OLD | NEW |