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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/object_reload.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_tools_api.h" 6 #include "include/dart_tools_api.h"
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
(...skipping 3065 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 3076
3077 Dart_SetFileModifiedCallback(&ExportModifiedCallback); 3077 Dart_SetFileModifiedCallback(&ExportModifiedCallback);
3078 lib = TestCase::ReloadTestScript(kReloadScript); 3078 lib = TestCase::ReloadTestScript(kReloadScript);
3079 EXPECT_VALID(lib); 3079 EXPECT_VALID(lib);
3080 Dart_SetFileModifiedCallback(NULL); 3080 Dart_SetFileModifiedCallback(NULL);
3081 3081
3082 // Modification of an exported library propagates. 3082 // Modification of an exported library propagates.
3083 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); 3083 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main"));
3084 } 3084 }
3085 3085
3086
3087 TEST_CASE(IsolateReload_SimpleConstFieldUpdate) {
3088 const char* kScript =
3089 "const value = 'a';\n"
3090 "main() {\n"
3091 " return 'value=${value}';\n"
3092 "}\n";
3093
3094 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3095 EXPECT_VALID(lib);
3096 EXPECT_STREQ("value=a", SimpleInvokeStr(lib, "main"));
3097
3098 const char* kReloadScript =
3099 "const value = 'b';\n"
3100 "main() {\n"
3101 " return 'value=${value}';\n"
3102 "}\n";
3103
3104 lib = TestCase::ReloadTestScript(kReloadScript);
3105 EXPECT_VALID(lib);
3106 EXPECT_STREQ("value=b", SimpleInvokeStr(lib, "main"));
3107 }
3108
3109
3110 TEST_CASE(IsolateReload_ConstFieldUpdate) {
3111 const char* kScript =
3112 "const value = const Duration(seconds: 1);\n"
3113 "main() {\n"
3114 " return 'value=${value}';\n"
3115 "}\n";
3116
3117 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3118 EXPECT_VALID(lib);
3119 EXPECT_STREQ("value=0:00:01.000000", SimpleInvokeStr(lib, "main"));
3120
3121 const char* kReloadScript =
3122 "const value = const Duration(seconds: 2);\n"
3123 "main() {\n"
3124 " return 'value=${value}';\n"
3125 "}\n";
3126
3127 lib = TestCase::ReloadTestScript(kReloadScript);
3128 EXPECT_VALID(lib);
3129 EXPECT_STREQ("value=0:00:02.000000", SimpleInvokeStr(lib, "main"));
3130 }
3131
3086 #endif // !PRODUCT 3132 #endif // !PRODUCT
3087 3133
3088 } // namespace dart 3134 } // namespace dart
OLDNEW
« 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