mirror of
https://github.com/servo/servo
synced 2026-04-28 18:37:39 +02:00
Sync WebIDL.py with gecko
This commit is contained in:
@@ -167,6 +167,22 @@ def WebIDLTest(parser, harness):
|
||||
|
||||
harness.ok(threw, "Trailing dictionary arg must be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional A arg);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Trailing dictionary arg must have a default value")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
@@ -184,6 +200,23 @@ def WebIDLTest(parser, harness):
|
||||
harness.ok(threw,
|
||||
"Trailing union arg containing a dictionary must be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional (A or DOMString) arg);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Trailing union arg containing a dictionary must have a default value")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
@@ -200,6 +233,22 @@ def WebIDLTest(parser, harness):
|
||||
|
||||
harness.ok(threw, "Dictionary arg followed by optional arg must be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional A arg1, optional long arg2);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Dictionary arg followed by optional arg must have default value")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
@@ -235,6 +284,24 @@ def WebIDLTest(parser, harness):
|
||||
"Union arg containing dictionary followed by optional arg must "
|
||||
"be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional (A or DOMString) arg1, optional long arg2);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Union arg containing dictionary followed by optional arg must "
|
||||
"have a default value")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
@@ -326,7 +393,7 @@ def WebIDLTest(parser, harness):
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional A arg);
|
||||
void doFoo(optional A arg = {});
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
@@ -337,12 +404,23 @@ def WebIDLTest(parser, harness):
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional (A or DOMString) arg);
|
||||
void doFoo(optional (A or DOMString) arg = {});
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
harness.ok(True, "Union arg containing a dictionary should actually parse")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(optional (A or DOMString) arg = "abc");
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
harness.ok(True, "Union arg containing a dictionary with string default should actually parse")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user