blob: 412ddf4f08eb0fd75dde343bf26ab59c41006687 [file] [log] [blame]
Test that URL username and password accessors encode/decode correctly
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Basic syntax
PASS build('user').toString() is "http://user@www.apple.com/"
PASS build('user').username is "user"
PASS build('%').toString() is "http://%@www.apple.com/"
PASS build('%').username is "%"
PASS build('%%').toString() is "http://%%@www.apple.com/"
PASS build('%%').username is "%%"
PASS build('%z').toString() is "http://%z@www.apple.com/"
PASS build('%z').username is "%z"
PASS build('%61').toString() is "http://%61@www.apple.com/"
PASS build('%61').username is "%61"
PASS build('%40').toString() is "http://%40@www.apple.com/"
PASS build('%40').username is "%40"
Simple encode set
PASS build('').toString() is "http://%07%7F@www.apple.com/"
PASS build('user', '').toString() is "http://user:%07%7F@www.apple.com/"
Default encode set additions
PASS build(' "#><?`').toString() is "http://%20%22%23%3E%3C%3F%60@www.apple.com/"
PASS build('user', ' "#><?`').toString() is "http://user:%20%22%23%3E%3C%3F%60@www.apple.com/"
Password encode set additions
PASS build('/@\\').toString() is "http://%2F%40%5C@www.apple.com/"
PASS build('user', '/@\\').toString() is "http://user:%2F%40%5C@www.apple.com/"
':' shouldn't be encoded in the password per the URL Standard, although both Firefox and Chrome encode it
FAIL build('user', ':').toString() should be http://user::@www.apple.com/. Was http://user:%3A@www.apple.com/.
Username encode set addition
PASS build(':').toString() is "http://%3A@www.apple.com/"
8-bit
PASS build('юзер', 'пароль').toString() is "http://%D1%8E%D0%B7%D0%B5%D1%80:%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C@www.apple.com/"
PASS build('юзер').username is "%D1%8E%D0%B7%D0%B5%D1%80"
PASS build('user', 'пароль').password is "%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C"
Some special characters that don't get encoded when used in credentials
PASS build('!$&*()-+~').toString() is "http://!$&*()-+~@www.apple.com/"
Some characters that shouldn't be encoded per the URL Standard, although both Firefox and Chrome encode them
FAIL build('^{|}[]=').toString() should be http://^{|}[]=@www.apple.com/. Was http://%5E%7B%7C%7D%5B%5D%3D@www.apple.com/.
PASS successfullyParsed is true
Some tests failed.
TEST COMPLETE