summaryrefslogtreecommitdiffstats
path: root/intl/uconv/tests/unit/test_unEscapeURIForUI.js
blob: 7f2fb167ccdd88aac1a3a9e39061d7b2ce7dfd12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Tests for nsITextToSubURI.unEscapeURIForUI
function run_test() {
  // Tests whether incomplete multibyte sequences throw.
  const tests = [
    {
      input: "http://example.com/?p=%E3%80%82",
      //TODO: should be the same as input, bug 1248812
      expected: "http://example.com/?p=%u3002",
    },
    {
      input: "http://example.com/?name=%E3%80%82",
      dontEscape: true,
      expected: "http://example.com/?name=\u3002",
    },
  ];

  for (const t of tests) {
    Assert.equal(
      Services.textToSubURI.unEscapeURIForUI(t.input, t.dontEscape),
      t.expected
    );
  }
}