diff options
author | Jack Moffitt <jack@metajack.im> | 2014-08-28 09:34:23 -0600 |
---|---|---|
committer | Jack Moffitt <jack@metajack.im> | 2014-09-08 20:21:42 -0600 |
commit | c6ab60dbfc6da7b4f800c9e40893c8b58413960c (patch) | |
tree | d1d74076cf7fa20e4f77ec7cb82cae98b67362cb /components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py | |
parent | db2f642c32fc5bed445bb6f2e45b0f6f0b4342cf (diff) | |
download | servo-c6ab60dbfc6da7b4f800c9e40893c8b58413960c.tar.gz servo-c6ab60dbfc6da7b4f800c9e40893c8b58413960c.zip |
Cargoify servo
Diffstat (limited to 'components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py')
-rw-r--r-- | components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py b/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py new file mode 100644 index 00000000000..3d0e5ca479f --- /dev/null +++ b/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py @@ -0,0 +1,56 @@ +import WebIDL + +def WebIDLTest(parser, harness): + parser.parse(""" + callback Function = any(any... arguments); + + interface TestTreatNonCallableAsNull1 { + [TreatNonCallableAsNull] attribute Function? onfoo; + attribute Function? onbar; + }; + """) + + results = parser.finish() + + iface = results[1] + attr = iface.members[0] + harness.check(attr.type.treatNonCallableAsNull(), True, "Got the expected value") + attr = iface.members[1] + harness.check(attr.type.treatNonCallableAsNull(), False, "Got the expected value") + + parser = parser.reset() + + threw = False + try: + parser.parse(""" + callback Function = any(any... arguments); + + interface TestTreatNonCallableAsNull2 { + [TreatNonCallableAsNull] attribute Function onfoo; + }; + """) + + results = parser.finish() + except: + threw = True + + harness.ok(threw, "Should have thrown.") + + parser = parser.reset() + + threw = False + try: + parser.parse(""" + callback Function = any(any... arguments); + + [TreatNonCallableAsNull] + interface TestTreatNonCallableAsNull3 { + attribute Function onfoo; + }; + """) + + results = parser.finish() + except: + threw = True + + harness.ok(threw, "Should have thrown.") |