diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /netwerk/test/unit/test_idnservice.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'netwerk/test/unit/test_idnservice.js')
-rw-r--r-- | netwerk/test/unit/test_idnservice.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/netwerk/test/unit/test_idnservice.js b/netwerk/test/unit/test_idnservice.js new file mode 100644 index 000000000..e6d659857 --- /dev/null +++ b/netwerk/test/unit/test_idnservice.js @@ -0,0 +1,25 @@ +// Tests nsIIDNService + +var reference = [ + // The 3rd element indicates whether the second element + // is ACE-encoded + ["asciihost", "asciihost", false], + ["b\u00FCcher", "xn--bcher-kva", true] + ]; + +function run_test() { + var idnService = Components.classes["@mozilla.org/network/idn-service;1"] + .getService(Components.interfaces.nsIIDNService); + + for (var i = 0; i < reference.length; ++i) { + dump("Testing " + reference[i] + "\n"); + // We test the following: + // - Converting UTF-8 to ACE and back gives us the expected answer + // - Converting the ASCII string UTF-8 -> ACE leaves the string unchanged + // - isACE returns true when we expect it to (third array elem true) + do_check_eq(idnService.convertUTF8toACE(reference[i][0]), reference[i][1]); + do_check_eq(idnService.convertUTF8toACE(reference[i][1]), reference[i][1]); + do_check_eq(idnService.convertACEtoUTF8(reference[i][1]), reference[i][0]); + do_check_eq(idnService.isACE(reference[i][1]), reference[i][2]); + } +} |