add unit test for bug 402013.

This commit is contained in:
dwitte@stanford.edu 2007-12-04 18:28:37 -08:00
parent 64adc7a6ff
commit 7dd07fec6d

View File

@ -80,4 +80,15 @@ function run_test() {
} catch(e) {
do_check_eq(e.result, NS_ERROR_HOST_IS_IP_ADDRESS);
}
// check normalization: output should be consistent with
// nsIURI::GetAsciiHost(), i.e. lowercased and ASCII/ACE encoded
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI("http://b\u00FCcher.co.uk", null, null);
do_check_eq(tld.getBaseDomain(uri), "xn--bcher-kva.co.uk");
do_check_eq(tld.getBaseDomainFromHost("b\u00FCcher.co.uk"), "xn--bcher-kva.co.uk");
do_check_eq(tld.getPublicSuffix(uri), "co.uk");
do_check_eq(tld.getPublicSuffixFromHost("b\u00FCcher.co.uk"), "co.uk");
}