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

Unified Diff: runtime/vm/isolate_reload_test.cc

Issue 2474193002: During a reload, give const fields their new values. (Closed)
Patch Set: Created 4 years, 1 month 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 | runtime/vm/object_reload.cc » ('j') | 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 c8282e4cbdb5375207178bee5d034f830553cc69..7fabfe719dd568d53a927835db58e8c9541e5fa1 100644
--- a/runtime/vm/isolate_reload_test.cc
+++ b/runtime/vm/isolate_reload_test.cc
@@ -3083,6 +3083,52 @@ TEST_CASE(IsolateReload_ExportedLibModified) {
EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main"));
}
+
+TEST_CASE(IsolateReload_SimpleConstFieldUpdate) {
+ const char* kScript =
+ "const value = 'a';\n"
+ "main() {\n"
+ " return 'value=${value}';\n"
+ "}\n";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
+ EXPECT_VALID(lib);
+ EXPECT_STREQ("value=a", SimpleInvokeStr(lib, "main"));
+
+ const char* kReloadScript =
+ "const value = 'b';\n"
+ "main() {\n"
+ " return 'value=${value}';\n"
+ "}\n";
+
+ lib = TestCase::ReloadTestScript(kReloadScript);
+ EXPECT_VALID(lib);
+ EXPECT_STREQ("value=b", SimpleInvokeStr(lib, "main"));
+}
+
+
+TEST_CASE(IsolateReload_ConstFieldUpdate) {
+ const char* kScript =
+ "const value = const Duration(seconds: 1);\n"
+ "main() {\n"
+ " return 'value=${value}';\n"
+ "}\n";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
+ EXPECT_VALID(lib);
+ EXPECT_STREQ("value=0:00:01.000000", SimpleInvokeStr(lib, "main"));
+
+ const char* kReloadScript =
+ "const value = const Duration(seconds: 2);\n"
+ "main() {\n"
+ " return 'value=${value}';\n"
+ "}\n";
+
+ lib = TestCase::ReloadTestScript(kReloadScript);
+ EXPECT_VALID(lib);
+ EXPECT_STREQ("value=0:00:02.000000", SimpleInvokeStr(lib, "main"));
+}
+
#endif // !PRODUCT
} // namespace dart
« no previous file with comments | « no previous file | runtime/vm/object_reload.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698