summaryrefslogtreecommitdiffstats
path: root/dom/bindings/parser/tests/test_attr_sequence_type.py
diff options
context:
space:
mode:
Diffstat (limited to 'dom/bindings/parser/tests/test_attr_sequence_type.py')
-rw-r--r--dom/bindings/parser/tests/test_attr_sequence_type.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/dom/bindings/parser/tests/test_attr_sequence_type.py b/dom/bindings/parser/tests/test_attr_sequence_type.py
new file mode 100644
index 0000000000..afbc732974
--- /dev/null
+++ b/dom/bindings/parser/tests/test_attr_sequence_type.py
@@ -0,0 +1,77 @@
+def WebIDLTest(parser, harness):
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface AttrSequenceType {
+ attribute sequence<object> foo;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Attribute type must not be a sequence type")
+
+ parser.reset()
+
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface AttrUnionWithSequenceType {
+ attribute (sequence<object> or DOMString) foo;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(threw, "Attribute type must not be a union with a sequence member type")
+
+ parser.reset()
+
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface AttrNullableUnionWithSequenceType {
+ attribute (sequence<object>? or DOMString) foo;
+ };
+ """
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(
+ threw,
+ "Attribute type must not be a union with a nullable sequence " "member type",
+ )
+
+ parser.reset()
+
+ threw = False
+ try:
+ parser.parse(
+ "\n"
+ " interface AttrUnionWithUnionWithSequenceType {\n"
+ " attribute ((sequence<object> or DOMString) or "
+ "AttrUnionWithUnionWithSequenceType) foo;\n"
+ " };\n"
+ )
+
+ parser.finish()
+ except Exception:
+ threw = True
+
+ harness.ok(
+ threw,
+ "Attribute type must not be a union type with a union member "
+ "type that has a sequence member type",
+ )