зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1535647 followup. Adjust the WebIDL parser tests for not supporting nullable constants. r=bzbarsky
This commit is contained in:
Родитель
6be51098cc
Коммит
f992dd0ee2
|
@ -12,9 +12,6 @@ expected = [
|
|||
("::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),
|
||||
|
@ -39,9 +36,6 @@ def WebIDLTest(parser, harness):
|
|||
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;
|
||||
|
@ -78,3 +72,16 @@ def WebIDLTest(parser, harness):
|
|||
"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.")
|
||||
|
|
|
@ -4,15 +4,15 @@ def WebIDLTest(parser, harness):
|
|||
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()
|
||||
|
|
Загрузка…
Ссылка в новой задаче