dom/bindings/parser/tests/test_promise.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial