summaryrefslogtreecommitdiffstats
path: root/dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py
diff options
context:
space:
mode:
Diffstat (limited to 'dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py')
-rw-r--r--dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py168
1 files changed, 168 insertions, 0 deletions
diff --git a/dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py b/dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py
new file mode 100644
index 0000000000..d8398d46ba
--- /dev/null
+++ b/dom/bindings/parser/tests/test_interface_identifier_conflicts_across_members.py
@@ -0,0 +1,168 @@
+def WebIDLTest(parser, harness):
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface IdentifierConflictAcrossMembers1 {
+ const byte thing1 = 1;
+ readonly attribute long thing1;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers1.")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface IdentifierConflictAcrossMembers2 {
+ readonly attribute long thing1;
+ const byte thing1 = 1;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers2.")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface IdentifierConflictAcrossMembers3 {
+ getter boolean thing1(DOMString name);
+ readonly attribute long thing1;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers3.")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface IdentifierConflictAcrossMembers4 {
+ const byte thing1 = 1;
+ long thing1();
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers4.")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface IdentifierConflictAcrossMembers5 {
+ static long thing1();
+ undefined thing1();
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(
+ not threw, "Should not have thrown for IdentifierConflictAcrossMembers5."
+ )
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface mixin IdentifierConflictAcrossMembers6Mixin {
+ undefined thing1();
+ };
+ interface IdentifierConflictAcrossMembers6 {
+ static long thing1();
+ };
+ IdentifierConflictAcrossMembers6 includes IdentifierConflictAcrossMembers6Mixin;
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(
+ not threw, "Should not have thrown for IdentifierConflictAcrossMembers6."
+ )
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface IdentifierConflictAcrossMembers7 {
+ const byte thing1 = 1;
+ static readonly attribute long thing1;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers7.")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface IdentifierConflictAcrossMembers8 {
+ readonly attribute long thing1 = 1;
+ static readonly attribute long thing1;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers8.")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface IdentifierConflictAcrossMembers9 {
+ void thing1();
+ static readonly attribute long thing1;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for IdentifierConflictAcrossMembers9.")