Skip to content

Commit

Permalink
Fixes #1628. [Patterns] Type argument added to fix map pattern tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov authored Jan 4, 2023
1 parent 48926a6 commit 74cb5e7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
18 changes: 9 additions & 9 deletions LanguageFeatures/Patterns/map_A01_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ String test(Map map) {
}

main() {
Expect.equals("logical-or", test({1: 1}));
Expect.equals("logical-or", test({1: -42}));
Expect.equals("default", test({1: -100}));
Expect.equals("logical-and", test({2: 1}));
Expect.equals("default", test({2: 10}));
Expect.equals("relational", test({3: 1}));
Expect.equals("default", test({3: 0}));
Expect.equals("logical-or", test(<int, num>{1: 1}));
Expect.equals("logical-or", test(<int, num>{1: -42}));
Expect.equals("default", test(<int, num>{1: -100}));
Expect.equals("logical-and", test(<int, num>{2: 1}));
Expect.equals("default", test(<int, num>{2: 10}));
Expect.equals("relational", test(<int, num>{3: 1}));
Expect.equals("default", test(<int, num>{3: 0}));
Expect.equals("cast", test({4: 42}));
Expect.throws(() {test({4: "42"});});
Expect.equals("null-check", test({5: 42}));
Expand All @@ -96,10 +96,10 @@ main() {
Expect.equals("parenthesized", test({9: 42}));
Expect.equals("default", test({9: "42"}));
Expect.equals("list-1", test({10: [42, 42]}));
Expect.equals("list-2", test({10: ["42", 42]}));
Expect.equals("list-2", test({10: <Object>["42", 42]}));
Expect.equals("default", test({10: [Object(), 42]}));
Expect.equals("map-1", test({11: {1: 42}}));
Expect.equals("map-2", test({11: {"1": "42"}}));
Expect.equals("map-2", test({11: <String, String>{"1": "42"}}));
Expect.equals("default", test({11: {Object(): 42}}));
Expect.equals("record-1", test({12: (42,)}));
Expect.equals("record-2", test({12: (42, x: 0)}));
Expand Down
18 changes: 9 additions & 9 deletions LanguageFeatures/Patterns/map_A01_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ String test(Map map) {
}

main() {
Expect.equals("logical-or", test({1: 1}));
Expect.equals("logical-or", test({1: -42}));
Expect.equals("default", test({1: -100}));
Expect.equals("logical-and", test({2: 1}));
Expect.equals("default", test({2: 10}));
Expect.equals("relational", test({3: 1}));
Expect.equals("default", test({3: 0}));
Expect.equals("logical-or", test(<int, num>{1: 1}));
Expect.equals("logical-or", test(<int, num>{1: -42}));
Expect.equals("default", test(<int, num>{1: -100}));
Expect.equals("logical-and", test(<int, num>{2: 1}));
Expect.equals("default", test(<int, num>{2: 10}));
Expect.equals("relational", test(<int, num>{3: 1}));
Expect.equals("default", test(<int, num>{3: 0}));
Expect.equals("cast", test({4: 42}));
Expect.throws(() {test({4: "42"});});
Expect.equals("null-check", test({5: 42}));
Expand All @@ -117,10 +117,10 @@ main() {
Expect.equals("parenthesized", test({9: 42}));
Expect.equals("default", test({9: "42"}));
Expect.equals("list-1", test({10: [42, 42]}));
Expect.equals("list-2", test({10: ["42", 42]}));
Expect.equals("list-2", test({10: <Object>["42", 42]}));
Expect.equals("default", test({10: [Object(), 42]}));
Expect.equals("map-1", test({11: {1: 42}}));
Expect.equals("map-2", test({11: {"1": "42"}}));
Expect.equals("map-2", test({11: <String, String>{"1": "42"}}));
Expect.equals("default", test({11: {Object(): 42}}));
Expect.equals("record-1", test({12: (42,)}));
Expect.equals("record-2", test({12: (42, x: 0)}));
Expand Down
18 changes: 9 additions & 9 deletions LanguageFeatures/Patterns/map_A01_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ String test(Map map) {
}

main() {
Expect.equals("logical-or", test({1: 1}));
Expect.equals("logical-or", test({1: -42}));
Expect.equals("default", test({1: -100}));
Expect.equals("logical-and", test({2: 1}));
Expect.equals("default", test({2: 10}));
Expect.equals("relational", test({3: 1}));
Expect.equals("default", test({3: 0}));
Expect.equals("logical-or", test(<int, num>{1: 1}));
Expect.equals("logical-or", test(<int, num>{1: -42}));
Expect.equals("default", test(<int, num>{1: -100}));
Expect.equals("logical-and", test(<int, num>{2: 1}));
Expect.equals("default", test(<int, num>{2: 10}));
Expect.equals("relational", test(<int, num>{3: 1}));
Expect.equals("default", test(<int, num>{3: 0}));
Expect.equals("cast", test({4: 42}));
Expect.throws(() {test({4: "42"});});
Expect.equals("null-check", test({5: 42}));
Expand All @@ -134,10 +134,10 @@ main() {
Expect.equals("parenthesized", test({9: 42}));
Expect.equals("default", test({9: "42"}));
Expect.equals("list-1", test({10: [42, 42]}));
Expect.equals("list-2", test({10: ["42", 42]}));
Expect.equals("list-2", test({10: <Object>["42", 42]}));
Expect.equals("default", test({10: [Object(), 42]}));
Expect.equals("map-1", test({11: {1: 42}}));
Expect.equals("map-2", test({11: {"1": "42"}}));
Expect.equals("map-2", test({11: <String, String>{"1": "42"}}));
Expect.equals("default", test({11: {Object(): 42}}));
Expect.equals("record-1", test({12: (42,)}));
Expect.equals("record-2", test({12: (42, x: 0)}));
Expand Down

0 comments on commit 74cb5e7

Please sign in to comment.