mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update webidl.py from upstream
This commit is contained in:
parent
427003210b
commit
8f5db8a7e1
12 changed files with 201 additions and 76 deletions
|
@ -26,6 +26,31 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(dict2.members[1].identifier.name, "child",
|
||||
"'a' really comes before 'c'")
|
||||
|
||||
# Test partial dictionary.
|
||||
parser = parser.reset();
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
long c;
|
||||
long g;
|
||||
};
|
||||
partial dictionary A {
|
||||
long h;
|
||||
long d;
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
|
||||
dict1 = results[0];
|
||||
harness.check(len(dict1.members), 4, "Dict1 has four members")
|
||||
harness.check(dict1.members[0].identifier.name, "c",
|
||||
"c should be first")
|
||||
harness.check(dict1.members[1].identifier.name, "d",
|
||||
"d should come after c")
|
||||
harness.check(dict1.members[2].identifier.name, "g",
|
||||
"g should come after d")
|
||||
harness.check(dict1.members[3].identifier.name, "h",
|
||||
"h should be last")
|
||||
|
||||
# Now reset our parser
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
|
@ -42,6 +67,24 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(threw, "Should not allow name duplication in a dictionary")
|
||||
|
||||
# Test no name duplication across normal and partial dictionary.
|
||||
parser = parser.reset();
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
long prop = 5;
|
||||
};
|
||||
partial dictionary A {
|
||||
long prop;
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow name duplication across normal and partial dictionary")
|
||||
|
||||
# Now reset our parser again
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
def should_throw(parser, harness, message, code):
|
||||
parser = parser.reset();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
def should_throw(parser, harness, message, code):
|
||||
parser = parser.reset();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue