aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/parser/tests
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2019-02-25 11:48:45 +0530
committerManish Goregaokar <manishsmail@gmail.com>2019-03-01 16:58:46 +0530
commit8f5db8a7e114ec9a6705da5284f9e5abc3bc7cd2 (patch)
tree6165f7e9338d3e491cc8774c081178229ecf2806 /components/script/dom/bindings/codegen/parser/tests
parent427003210b3e16a82f958e35ff4212f26ffa35ab (diff)
downloadservo-8f5db8a7e114ec9a6705da5284f9e5abc3bc7cd2.tar.gz
servo-8f5db8a7e114ec9a6705da5284f9e5abc3bc7cd2.zip
Update webidl.py from upstream
Diffstat (limited to 'components/script/dom/bindings/codegen/parser/tests')
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_dictionary.py43
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_lenientSetter.py2
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_replaceable.py2
3 files changed, 45 insertions, 2 deletions
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py b/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py
index 2c0fa61239d..361b83ea52b 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py
@@ -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
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_lenientSetter.py b/components/script/dom/bindings/codegen/parser/tests/test_lenientSetter.py
index 50e9df658e9..78a9ffe9eaa 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_lenientSetter.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_lenientSetter.py
@@ -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();
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_replaceable.py b/components/script/dom/bindings/codegen/parser/tests/test_replaceable.py
index 78b1bf7e60b..93ee42ed919 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_replaceable.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_replaceable.py
@@ -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();