1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bindings/parser/tests/test_promise.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +def WebIDLTest(parser, harness): 1.5 + threw = False 1.6 + try: 1.7 + parser.parse(""" 1.8 + interface Promise {}; 1.9 + interface A { 1.10 + legacycaller Promise foo(); 1.11 + }; 1.12 + """) 1.13 + results = parser.finish() 1.14 + 1.15 + except: 1.16 + threw = True 1.17 + harness.ok(threw, 1.18 + "Should not allow Promise return values for legacycaller.") 1.19 + 1.20 + parser = parser.reset() 1.21 + threw = False 1.22 + try: 1.23 + parser.parse(""" 1.24 + interface Promise {}; 1.25 + interface A { 1.26 + Promise foo(); 1.27 + long foo(long arg); 1.28 + }; 1.29 + """) 1.30 + results = parser.finish(); 1.31 + except: 1.32 + threw = True 1.33 + harness.ok(threw, 1.34 + "Should not allow overloads which have both Promise and " 1.35 + "non-Promise return types.") 1.36 + 1.37 + parser = parser.reset() 1.38 + threw = False 1.39 + try: 1.40 + parser.parse(""" 1.41 + interface Promise {}; 1.42 + interface A { 1.43 + long foo(long arg); 1.44 + Promise foo(); 1.45 + }; 1.46 + """) 1.47 + results = parser.finish(); 1.48 + except: 1.49 + threw = True 1.50 + harness.ok(threw, 1.51 + "Should not allow overloads which have both Promise and " 1.52 + "non-Promise return types.") 1.53 + 1.54 + parser = parser.reset() 1.55 + parser.parse(""" 1.56 + interface Promise {}; 1.57 + interface A { 1.58 + Promise foo(); 1.59 + Promise foo(long arg); 1.60 + }; 1.61 + """) 1.62 + results = parser.finish(); 1.63 + 1.64 + harness.ok(True, 1.65 + "Should allow overloads which only have Promise and return " 1.66 + "types.")