summaryrefslogtreecommitdiffstats
path: root/dom/bindings/parser/tests/test_cereactions.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/bindings/parser/tests/test_cereactions.py
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--dom/bindings/parser/tests/test_cereactions.py157
1 files changed, 157 insertions, 0 deletions
diff --git a/dom/bindings/parser/tests/test_cereactions.py b/dom/bindings/parser/tests/test_cereactions.py
new file mode 100644
index 0000000000..bf925e11ec
--- /dev/null
+++ b/dom/bindings/parser/tests/test_cereactions.py
@@ -0,0 +1,157 @@
+def WebIDLTest(parser, harness):
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface Foo {
+ [CEReactions(DOMString a)] void foo(boolean arg2);
+ };
+ """
+ )
+
+ results = parser.finish()
+ except:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface Foo {
+ [CEReactions(DOMString b)] readonly attribute boolean bar;
+ };
+ """
+ )
+
+ results = parser.finish()
+ except:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface Foo {
+ [CEReactions] attribute boolean bar;
+ };
+ """
+ )
+
+ results = parser.finish()
+ except Exception as e:
+ harness.ok(
+ False,
+ "Shouldn't have thrown for [CEReactions] used on writable attribute. %s"
+ % e,
+ )
+ threw = True
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface Foo {
+ [CEReactions] void foo(boolean arg2);
+ };
+ """
+ )
+
+ results = parser.finish()
+ except Exception as e:
+ harness.ok(
+ False,
+ "Shouldn't have thrown for [CEReactions] used on regular operations. %s"
+ % e,
+ )
+ threw = True
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface Foo {
+ [CEReactions] readonly attribute boolean A;
+ };
+ """
+ )
+
+ results = parser.finish()
+ except:
+ threw = True
+
+ harness.ok(
+ threw, "Should have thrown for [CEReactions] used on a readonly attribute"
+ )
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ [CEReactions]
+ interface Foo {
+ }
+ """
+ )
+
+ results = parser.finish()
+ except:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for [CEReactions] used on a interface")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface Foo {
+ [CEReactions] getter any(DOMString name);
+ };
+ """
+ )
+ results = parser.finish()
+ except:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for [CEReactions] used on a named getter")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface Foo {
+ [CEReactions] legacycaller double compute(double x);
+ };
+ """
+ )
+ results = parser.finish()
+ except:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for [CEReactions] used on a legacycaller")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse(
+ """
+ interface Foo {
+ [CEReactions] stringifier DOMString ();
+ };
+ """
+ )
+ results = parser.finish()
+ except:
+ threw = True
+
+ harness.ok(threw, "Should have thrown for [CEReactions] used on a stringifier")