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="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 shouldBe('window.atob("YQ==")', '"a"'); | 8 shouldBe('window.atob("YQ==")', '"a"'); |
9 shouldBe('window.atob("YWI=")', '"ab"'); | 9 shouldBe('window.atob("YWI=")', '"ab"'); |
10 shouldBe('window.atob("YWJj")', '"abc"'); | 10 shouldBe('window.atob("YWJj")', '"abc"'); |
11 shouldBe('window.atob("YWJjZA==")', '"abcd"'); | 11 shouldBe('window.atob("YWJjZA==")', '"abcd"'); |
12 shouldBe('window.atob("YWJjZGU=")', '"abcde"'); | 12 shouldBe('window.atob("YWJjZGU=")', '"abcde"'); |
13 shouldBe('window.atob("YWJjZGVm")', '"abcdef"'); | 13 shouldBe('window.atob("YWJjZGVm")', '"abcdef"'); |
14 shouldBe('window.btoa("a")', '"YQ=="'); | 14 shouldBe('window.btoa("a")', '"YQ=="'); |
15 shouldBe('window.btoa("ab")', '"YWI="'); | 15 shouldBe('window.btoa("ab")', '"YWI="'); |
16 shouldBe('window.btoa("abc")', '"YWJj"'); | 16 shouldBe('window.btoa("abc")', '"YWJj"'); |
17 shouldBe('window.btoa("abcd")', '"YWJjZA=="'); | 17 shouldBe('window.btoa("abcd")', '"YWJjZA=="'); |
18 shouldBe('window.btoa("abcde")', '"YWJjZGU="'); | 18 shouldBe('window.btoa("abcde")', '"YWJjZGU="'); |
19 shouldBe('window.btoa("abcdef")', '"YWJjZGVm"'); | 19 shouldBe('window.btoa("abcdef")', '"YWJjZGVm"'); |
20 | 20 |
21 shouldBe('typeof window.btoa', '"function"'); | 21 shouldBe('typeof window.btoa', '"function"'); |
22 shouldBe('window.btoa()', '"dW5kZWZpbmVk"'); | 22 shouldThrow('window.btoa()', '"TypeError: Not enough arguments"'); |
23 shouldBe('window.btoa("")', '""'); | 23 shouldBe('window.btoa("")', '""'); |
24 shouldBe('window.btoa(null)', '""'); | 24 shouldBe('window.btoa(null)', '"bnVsbA=="'); // Gets converted to "null" string. |
25 shouldBe('window.btoa(undefined)', '"dW5kZWZpbmVk"'); | 25 shouldBe('window.btoa(undefined)', '"dW5kZWZpbmVk"'); |
26 shouldBe('window.btoa(window)', '"W29iamVjdCBXaW5kb3dd"'); // "[object Window]" | 26 shouldBe('window.btoa(window)', '"W29iamVjdCBXaW5kb3dd"'); // "[object Window]" |
27 shouldBe('window.btoa("éé")', '"6ek="'); | 27 shouldBe('window.btoa("éé")', '"6ek="'); |
28 shouldBe('window.btoa("\\u0080\\u0081")', '"gIE="'); | 28 shouldBe('window.btoa("\\u0080\\u0081")', '"gIE="'); |
29 shouldThrow('window.btoa("тест")'); | 29 shouldThrow('window.btoa("тест")'); |
30 window.btoa = 0; | 30 window.btoa = 0; |
31 shouldBe('window.btoa', '0'); | 31 shouldBe('window.btoa', '0'); |
32 shouldBe('typeof window.btoa', '"number"'); | 32 shouldBe('typeof window.btoa', '"number"'); |
33 | 33 |
34 shouldBe('typeof window.atob', '"function"'); | 34 shouldBe('typeof window.atob', '"function"'); |
35 shouldThrow('window.atob()'); // 'undefined' | 35 shouldThrow('window.atob()', '"TypeError: Not enough arguments"'); |
36 shouldBe('window.atob("")', '""'); | 36 shouldBe('window.atob("")', '""'); |
37 shouldBe('window.atob(null)', '""'); | 37 shouldBe('window.atob(null)', '"\x9Eée"'); // Gets converted to "null" string. |
38 shouldThrow('window.atob(undefined)'); | 38 shouldThrow('window.atob(undefined)'); |
39 shouldThrow('window.atob(" YQ==")'); | 39 shouldThrow('window.atob(" YQ==")'); |
40 shouldThrow('window.atob("YQ==\\u000a")'); | 40 shouldThrow('window.atob("YQ==\\u000a")'); |
41 shouldBe('window.atob("6ek=")', '"éé"'); | 41 shouldBe('window.atob("6ek=")', '"éé"'); |
42 shouldBe('window.atob("6ek")', '"éé"'); | 42 shouldBe('window.atob("6ek")', '"éé"'); |
43 shouldBe('window.atob("gIE=")', '"\u0080\u0081"'); | 43 shouldBe('window.atob("gIE=")', '"\u0080\u0081"'); |
44 shouldThrow('window.atob("тест")'); | 44 shouldThrow('window.atob("тест")'); |
45 shouldThrow('window.atob("z")'); | 45 shouldThrow('window.atob("z")'); |
46 shouldBe('window.atob("zz")', '"Ï"'); | 46 shouldBe('window.atob("zz")', '"Ï"'); |
47 shouldBe('window.atob("zzz")', '"Ï\u003C"'); | 47 shouldBe('window.atob("zzz")', '"Ï\u003C"'); |
(...skipping 10 matching lines...) Loading... |
58 shouldThrow('window.atob("====")'); | 58 shouldThrow('window.atob("====")'); |
59 shouldThrow('window.atob("=====")'); | 59 shouldThrow('window.atob("=====")'); |
60 window.atob = 0; | 60 window.atob = 0; |
61 shouldBe('window.atob', '0'); | 61 shouldBe('window.atob', '0'); |
62 shouldBe('typeof window.atob', '"number"'); | 62 shouldBe('typeof window.atob', '"number"'); |
63 | 63 |
64 </script> | 64 </script> |
65 <script src="../../js/resources/js-test-post.js"></script> | 65 <script src="../../js/resources/js-test-post.js"></script> |
66 </body> | 66 </body> |
67 </html> | 67 </html> |
OLD | NEW |