Bug 1535647 followup. Adjust the WebIDL parser tests for not supporting nullable constants. r=bzbarsky
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 15 Mar 2019 21:12:10 -0400
changeset 464678 536a6957d254ec3f91e2c80c5b9ef8eb592da14c
parent 464677 2f4bd03bfc3568c8fb27667efb9a63dbaebf9d0f
child 464679 4f3f5decaa5fc85883a86dc508655dc17e8610ec
push id112465
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:50:10 +0000
treeherdermozilla-inbound@e0861be8d6c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1535647
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1535647 followup. Adjust the WebIDL parser tests for not supporting nullable constants. r=bzbarsky
dom/bindings/parser/tests/test_const.py
dom/bindings/parser/tests/test_typedef.py
--- a/dom/bindings/parser/tests/test_const.py
+++ b/dom/bindings/parser/tests/test_const.py
@@ -7,19 +7,16 @@ expected = [
     ("::TestConsts::s", "s", "Short", -3),
     ("::TestConsts::us", "us", "UnsignedShort", 4),
     ("::TestConsts::l", "l", "Long", -5),
     ("::TestConsts::ul", "ul", "UnsignedLong", 6),
     ("::TestConsts::ull", "ull", "UnsignedLongLong", 7),
     ("::TestConsts::ll", "ll", "LongLong", -8),
     ("::TestConsts::t", "t", "Boolean", True),
     ("::TestConsts::f", "f", "Boolean", False),
-    ("::TestConsts::n", "n", "BooleanOrNull", None),
-    ("::TestConsts::nt", "nt", "BooleanOrNull", True),
-    ("::TestConsts::nf", "nf", "BooleanOrNull", False),
     ("::TestConsts::fl", "fl", "Float", 0.2),
     ("::TestConsts::db", "db", "Double", 0.2),
     ("::TestConsts::ufl", "ufl", "UnrestrictedFloat", 0.2),
     ("::TestConsts::udb", "udb", "UnrestrictedDouble", 0.2),
     ("::TestConsts::fli", "fli", "Float", 2),
     ("::TestConsts::dbi", "dbi", "Double", 2),
     ("::TestConsts::ufli", "ufli", "UnrestrictedFloat", 2),
     ("::TestConsts::udbi", "udbi", "UnrestrictedDouble", 2),
@@ -34,19 +31,16 @@ def WebIDLTest(parser, harness):
           const short s = -3;
           const unsigned short us = 0x4;
           const long l = -0X5;
           const unsigned long ul = 6;
           const unsigned long long ull = 7;
           const long long ll = -010;
           const boolean t = true;
           const boolean f = false;
-          const boolean? n = null;
-          const boolean? nt = true;
-          const boolean? nf = false;
           const float fl = 0.2;
           const double db = 0.2;
           const unrestricted float ufl = 0.2;
           const unrestricted double udb = 0.2;
           const float fli = 2;
           const double dbi = 2;
           const unrestricted float ufli = 2;
           const unrestricted double udbi = 2;
@@ -73,8 +67,21 @@ def WebIDLTest(parser, harness):
         harness.check(const.identifier.QName(), QName, "Const has the right QName")
         harness.check(const.identifier.name, name, "Const has the right name")
         harness.check(str(const.type), type, "Const has the right type")
         harness.ok(const.type.isPrimitive(), "All consts should be primitive")
         harness.check(str(const.value.type), str(const.type),
                       "Const's value has the same type as the type")
         harness.check(const.value.value, value, "Const value has the right value.")
 
+
+    parser = parser.reset()
+    threw = False
+    try:
+        parser.parse("""
+          interface TestConsts {
+            const boolean? zero = 0;
+          };
+        """)
+        parser.finish()
+    except:
+        threw = True
+    harness.ok(threw, "Nullable types are not allowed for consts.")
--- a/dom/bindings/parser/tests/test_typedef.py
+++ b/dom/bindings/parser/tests/test_typedef.py
@@ -1,23 +1,23 @@
 def WebIDLTest(parser, harness):
     parser.parse("""
       typedef long mylong;
       typedef long? mynullablelong;
       interface Foo {
         const mylong X = 5;
-        const mynullablelong Y = 7;
-        const mynullablelong Z = null;
-        void foo(mylong arg);
+        void foo(optional mynullablelong arg = 7);
+        void bar(optional mynullablelong arg = null);
+        void baz(mylong arg);
       };
     """)
 
     results = parser.finish()
 
-    harness.check(results[2].members[1].type.name, "LongOrNull",
+    harness.check(results[2].members[1].signatures()[0][1][0].type.name, "LongOrNull",
                   "Should expand typedefs")
 
     parser = parser.reset()
     threw = False
     try:
         parser.parse("""
           typedef long? mynullablelong;
           interface Foo {