Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | import WebIDL |
michael@0 | 2 | |
michael@0 | 3 | def WebIDLTest(parser, harness): |
michael@0 | 4 | parser.parse(""" |
michael@0 | 5 | [TreatNonCallableAsNull] callback Function = any(any... arguments); |
michael@0 | 6 | |
michael@0 | 7 | interface TestTreatNonCallableAsNull1 { |
michael@0 | 8 | attribute Function? onfoo; |
michael@0 | 9 | attribute Function onbar; |
michael@0 | 10 | }; |
michael@0 | 11 | """) |
michael@0 | 12 | |
michael@0 | 13 | results = parser.finish() |
michael@0 | 14 | |
michael@0 | 15 | iface = results[1] |
michael@0 | 16 | attr = iface.members[0] |
michael@0 | 17 | harness.check(attr.type.treatNonCallableAsNull(), True, "Got the expected value") |
michael@0 | 18 | attr = iface.members[1] |
michael@0 | 19 | harness.check(attr.type.treatNonCallableAsNull(), False, "Got the expected value") |
michael@0 | 20 | |
michael@0 | 21 | parser = parser.reset() |
michael@0 | 22 | |
michael@0 | 23 | threw = False |
michael@0 | 24 | try: |
michael@0 | 25 | parser.parse(""" |
michael@0 | 26 | callback Function = any(any... arguments); |
michael@0 | 27 | |
michael@0 | 28 | interface TestTreatNonCallableAsNull2 { |
michael@0 | 29 | [TreatNonCallableAsNull] attribute Function onfoo; |
michael@0 | 30 | }; |
michael@0 | 31 | """) |
michael@0 | 32 | |
michael@0 | 33 | results = parser.finish() |
michael@0 | 34 | except: |
michael@0 | 35 | threw = True |
michael@0 | 36 | |
michael@0 | 37 | harness.ok(threw, "Should have thrown.") |
michael@0 | 38 | |
michael@0 | 39 | parser = parser.reset() |
michael@0 | 40 | |
michael@0 | 41 | threw = False |
michael@0 | 42 | try: |
michael@0 | 43 | parser.parse(""" |
michael@0 | 44 | callback Function = any(any... arguments); |
michael@0 | 45 | |
michael@0 | 46 | [TreatNonCallableAsNull] |
michael@0 | 47 | interface TestTreatNonCallableAsNull3 { |
michael@0 | 48 | attribute Function onfoo; |
michael@0 | 49 | }; |
michael@0 | 50 | """) |
michael@0 | 51 | |
michael@0 | 52 | results = parser.finish() |
michael@0 | 53 | except: |
michael@0 | 54 | threw = True |
michael@0 | 55 | |
michael@0 | 56 | harness.ok(threw, "Should have thrown.") |
michael@0 | 57 | |
michael@0 | 58 | parser = parser.reset() |
michael@0 | 59 | |
michael@0 | 60 | threw = False |
michael@0 | 61 | try: |
michael@0 | 62 | parser.parse(""" |
michael@0 | 63 | [TreatNonCallableAsNull, TreatNonObjectAsNull] |
michael@0 | 64 | callback Function = any(any... arguments); |
michael@0 | 65 | """) |
michael@0 | 66 | |
michael@0 | 67 | results = parser.finish() |
michael@0 | 68 | except: |
michael@0 | 69 | threw = True |
michael@0 | 70 | |
michael@0 | 71 | harness.ok(threw, "Should have thrown.") |