aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/parser/tests/test_promise.py
diff options
context:
space:
mode:
authorsagudev <16504129+sagudev@users.noreply.github.com>2023-02-19 13:36:13 +0100
committersagudev <16504129+sagudev@users.noreply.github.com>2023-02-19 13:36:13 +0100
commit4d393612b49343b141acdbe5a0b5dd7acc43eb65 (patch)
treed8b42941c9e649feddd46e6d7f636cf36a6ababc /components/script/dom/bindings/codegen/parser/tests/test_promise.py
parent6f563830d12586439380dedc8f58cf1af6f9b81a (diff)
downloadservo-4d393612b49343b141acdbe5a0b5dd7acc43eb65.tar.gz
servo-4d393612b49343b141acdbe5a0b5dd7acc43eb65.zip
Update WebIDL
Diffstat (limited to 'components/script/dom/bindings/codegen/parser/tests/test_promise.py')
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_promise.py136
1 files changed, 78 insertions, 58 deletions
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_promise.py b/components/script/dom/bindings/codegen/parser/tests/test_promise.py
index ef44a216d10..9b418d51afe 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_promise.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_promise.py
@@ -1,157 +1,177 @@
def WebIDLTest(parser, harness):
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
legacycaller Promise<any> foo();
};
- """)
+ """
+ )
results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow Promise return values for legacycaller.")
+ harness.ok(threw, "Should not allow Promise return values for legacycaller.")
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
Promise<any> foo();
long foo(long arg);
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow overloads which have both Promise and "
- "non-Promise return types.")
+ harness.ok(
+ threw,
+ "Should not allow overloads which have both Promise and "
+ "non-Promise return types.",
+ )
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
long foo(long arg);
Promise<any> foo();
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow overloads which have both Promise and "
- "non-Promise return types.")
+ harness.ok(
+ threw,
+ "Should not allow overloads which have both Promise and "
+ "non-Promise return types.",
+ )
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
Promise<any>? foo();
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow nullable Promise return values.")
+ harness.ok(threw, "Should not allow nullable Promise return values.")
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
undefined foo(Promise<any>? arg);
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow nullable Promise arguments.")
+ harness.ok(threw, "Should not allow nullable Promise arguments.")
parser = parser.reset()
- parser.parse("""
+ parser.parse(
+ """
interface A {
Promise<any> foo();
Promise<any> foo(long arg);
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
- harness.ok(True,
- "Should allow overloads which only have Promise and return "
- "types.")
+ harness.ok(
+ True, "Should allow overloads which only have Promise and return " "types."
+ )
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
attribute Promise<any> attr;
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow writable Promise-typed attributes.")
+ harness.ok(threw, "Should not allow writable Promise-typed attributes.")
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
- [LenientSetter] readonly attribute Promise<any> attr;
+ [LegacyLenientSetter] readonly attribute Promise<any> attr;
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow [LenientSetter] Promise-typed attributes.")
+ harness.ok(
+ threw, "Should not allow [LegacyLenientSetter] Promise-typed attributes."
+ )
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
[PutForwards=bar] readonly attribute Promise<any> attr;
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow [PutForwards] Promise-typed attributes.")
+ harness.ok(threw, "Should not allow [PutForwards] Promise-typed attributes.")
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
[Replaceable] readonly attribute Promise<any> attr;
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow [Replaceable] Promise-typed attributes.")
+ harness.ok(threw, "Should not allow [Replaceable] Promise-typed attributes.")
parser = parser.reset()
threw = False
try:
- parser.parse("""
+ parser.parse(
+ """
interface A {
[SameObject] readonly attribute Promise<any> attr;
};
- """)
- results = parser.finish();
+ """
+ )
+ results = parser.finish()
except:
threw = True
- harness.ok(threw,
- "Should not allow [SameObject] Promise-typed attributes.")
+ harness.ok(threw, "Should not allow [SameObject] Promise-typed attributes.")