tor-browser

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

test_identifier_conflict.py (1161B)


      1 def WebIDLTest(parser, harness):
      2    try:
      3        parser.parse(
      4            """
      5            enum Foo { "a" };
      6            interface Foo;
      7        """
      8        )
      9        parser.finish()
     10        harness.ok(False, "Should fail to parse")
     11    except Exception as e:
     12        harness.ok(
     13            "Name collision" in str(e), "Should have name collision for interface"
     14        )
     15 
     16    parser = parser.reset()
     17    try:
     18        parser.parse(
     19            """
     20            dictionary Foo { long x; };
     21            enum Foo { "a" };
     22        """
     23        )
     24        parser.finish()
     25        harness.ok(False, "Should fail to parse")
     26    except Exception as e:
     27        harness.ok(
     28            "Name collision" in str(e), "Should have name collision for dictionary"
     29        )
     30 
     31    parser = parser.reset()
     32    try:
     33        parser.parse(
     34            """
     35            enum Foo { "a" };
     36            enum Foo { "b" };
     37        """
     38        )
     39        parser.finish()
     40        harness.ok(False, "Should fail to parse")
     41    except Exception as e:
     42        harness.ok(
     43            "Multiple unresolvable definitions" in str(e),
     44            "Should have name collision for dictionary",
     45        )