tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_chromeutils_isJSIdentifier.js (1601B)


      1 "use strict";
      2 
      3 add_task(function test_isJSIdentifier() {
      4  Assert.equal(ChromeUtils.isJSIdentifier("foo"), true);
      5  Assert.equal(ChromeUtils.isJSIdentifier("$foo"), true);
      6  Assert.equal(ChromeUtils.isJSIdentifier("foo1"), true);
      7  Assert.equal(ChromeUtils.isJSIdentifier("_foo"), true);
      8 
      9  Assert.equal(ChromeUtils.isJSIdentifier("foo-"), false);
     10  Assert.equal(ChromeUtils.isJSIdentifier("foo~"), false);
     11  Assert.equal(ChromeUtils.isJSIdentifier("1foo"), false);
     12  Assert.equal(ChromeUtils.isJSIdentifier("🤣fo"), false);
     13  Assert.equal(ChromeUtils.isJSIdentifier("fo🤣"), false);
     14 
     15  Assert.equal(ChromeUtils.isJSIdentifier("\u3042"), true);
     16  Assert.equal(ChromeUtils.isJSIdentifier("A\u3042"), true);
     17  Assert.equal(ChromeUtils.isJSIdentifier("\u3042\u3042"), true);
     18  Assert.equal(ChromeUtils.isJSIdentifier("\u{29E49}"), true);
     19  Assert.equal(ChromeUtils.isJSIdentifier("A\u{29E49}"), true);
     20  Assert.equal(ChromeUtils.isJSIdentifier("\u{29E49}\u{29E49}"), true);
     21  Assert.equal(ChromeUtils.isJSIdentifier("\uFF10"), false);
     22  Assert.equal(ChromeUtils.isJSIdentifier("A\uFF10"), true);
     23  Assert.equal(ChromeUtils.isJSIdentifier("\uFF10\uFF10"), false);
     24  Assert.equal(ChromeUtils.isJSIdentifier("\u{11067}"), false);
     25  Assert.equal(ChromeUtils.isJSIdentifier("A\u{11067}"), true);
     26  Assert.equal(ChromeUtils.isJSIdentifier("\u{11067}\u{11067}"), false);
     27 
     28  Assert.equal(ChromeUtils.isJSIdentifier("A\0"), false);
     29  Assert.equal(ChromeUtils.isJSIdentifier("\0A"), false);
     30  Assert.equal(ChromeUtils.isJSIdentifier("A\0B"), false);
     31 
     32  Assert.equal(ChromeUtils.isJSIdentifier(""), false);
     33 });