|
1 def WebIDLTest(parser, harness): |
|
2 threw = False |
|
3 try: |
|
4 parser.parse(""" |
|
5 interface Promise {}; |
|
6 interface A { |
|
7 legacycaller Promise foo(); |
|
8 }; |
|
9 """) |
|
10 results = parser.finish() |
|
11 |
|
12 except: |
|
13 threw = True |
|
14 harness.ok(threw, |
|
15 "Should not allow Promise return values for legacycaller.") |
|
16 |
|
17 parser = parser.reset() |
|
18 threw = False |
|
19 try: |
|
20 parser.parse(""" |
|
21 interface Promise {}; |
|
22 interface A { |
|
23 Promise foo(); |
|
24 long foo(long arg); |
|
25 }; |
|
26 """) |
|
27 results = parser.finish(); |
|
28 except: |
|
29 threw = True |
|
30 harness.ok(threw, |
|
31 "Should not allow overloads which have both Promise and " |
|
32 "non-Promise return types.") |
|
33 |
|
34 parser = parser.reset() |
|
35 threw = False |
|
36 try: |
|
37 parser.parse(""" |
|
38 interface Promise {}; |
|
39 interface A { |
|
40 long foo(long arg); |
|
41 Promise foo(); |
|
42 }; |
|
43 """) |
|
44 results = parser.finish(); |
|
45 except: |
|
46 threw = True |
|
47 harness.ok(threw, |
|
48 "Should not allow overloads which have both Promise and " |
|
49 "non-Promise return types.") |
|
50 |
|
51 parser = parser.reset() |
|
52 parser.parse(""" |
|
53 interface Promise {}; |
|
54 interface A { |
|
55 Promise foo(); |
|
56 Promise foo(long arg); |
|
57 }; |
|
58 """) |
|
59 results = parser.finish(); |
|
60 |
|
61 harness.ok(True, |
|
62 "Should allow overloads which only have Promise and return " |
|
63 "types.") |