Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: runtime/vm/isolate_reload_test.cc

Issue 2184403002: Add another tear off closure reload test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate_reload_test.cc
diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc
index a2f1a99c4d6a8104867ca680a124b1e76aec1a2b..49672f6c3f2e7dbd1e33de146f20be1e3ef29f5e 100644
--- a/runtime/vm/isolate_reload_test.cc
+++ b/runtime/vm/isolate_reload_test.cc
@@ -1328,6 +1328,69 @@ TEST_CASE(IsolateReload_TearOff_Equality) {
}
+TEST_CASE(IsolateReload_TearOff_List_Set) {
+ const char* kScript =
+ "import 'test:isolate_reload_helper';\n"
+ "class C {\n"
+ " foo() => 'old';\n"
+ "}\n"
+ "List list = new List(2);\n"
+ "Set set = new Set();\n"
+ "main() {\n"
+ " var c = new C();\n"
+ " list[0] = c.foo;\n"
+ " list[1] = c#foo;\n"
+ " set.add(c.foo);\n"
+ " set.add(c#foo);\n"
+ " int countBefore = set.length;\n"
+ " reloadTest();\n"
+ " list[1] = c.foo;\n"
+ " set.add(c.foo);\n"
+ " set.add(c#foo);\n"
+ " int countAfter = set.length;\n"
+ " return '${list[0]()} ${list[1]()} ${list[0] == list[1]} '\n"
+ " '${countBefore == 1} ${countAfter == 1} ${(set.first)()} '\n"
+ " '${set.first == c.foo} ${set.first == c#foo} '\n"
+ " '${set.remove(c#foo)}';\n"
+ "}\n";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
+ EXPECT_VALID(lib);
+
+ const char* kReloadScript =
+ "import 'test:isolate_reload_helper';\n"
+ "class C {\n"
+ " foo() => 'new';\n"
+ "}\n"
+ "List list = new List(2);\n"
+ "Set set = new Set();\n"
+ "main() {\n"
+ " var c = new C();\n"
+ " list[0] = c.foo;\n"
+ " list[1] = c#foo;\n"
+ " set.add(c.foo);\n"
+ " set.add(c#foo);\n"
+ " int countBefore = set.length;\n"
+ " reloadTest();\n"
+ " list[1] = c.foo;\n"
+ " set.add(c.foo);\n"
+ " set.add(c#foo);\n"
+ " int countAfter = set.length;\n"
+ " return '${list[0]()} ${list[1]()} ${list[0] == list[1]} '\n"
+ " '${countBefore == 1} ${countAfter == 1} ${(set.first)()} '\n"
+ " '${set.first == c.foo} ${set.first == c#foo} '\n"
+ " '${set.remove(c#foo)}';\n"
+ "}\n";
+
+ TestCase::SetReloadTestScript(kReloadScript);
+
+ EXPECT_STREQ("new new true true true new true true true",
+ SimpleInvokeStr(lib, "main"));
+
+ lib = TestCase::GetReloadErrorOrRootLibrary();
+ EXPECT_VALID(lib);
+}
+
TEST_CASE(IsolateReload_EnumEquality) {
const char* kScript =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698