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

Side by Side Diff: runtime/vm/isolate_reload_test.cc

Issue 2259013002: Become: Also forward identity hashes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 4 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 unified diff | Download patch
« runtime/vm/become.cc ('K') | « runtime/vm/become.cc ('k') | no next file » | 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 2798 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 "main() {\n" 2809 "main() {\n"
2810 " return '$a $b';\n" 2810 " return '$a $b';\n"
2811 "}\n"; 2811 "}\n";
2812 2812
2813 lib = TestCase::ReloadTestScript(kReloadScript); 2813 lib = TestCase::ReloadTestScript(kReloadScript);
2814 EXPECT_VALID(lib); 2814 EXPECT_VALID(lib);
2815 EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main")); 2815 EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main"));
2816 } 2816 }
2817 2817
2818 2818
2819 TEST_CASE(IsolateReload_ShapeChangeRetainsHash) {
2820 const char* kScript =
2821 "class A{\n"
2822 " var x;\n"
2823 "}\n"
2824 "var a, hash1, hash2;\n"
2825 "main() {\n"
2826 " a = new A();\n"
2827 " hash1 = a.hashCode;\n"
2828 " return 'okay';\n"
2829 "}\n";
2830
2831 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2832 EXPECT_VALID(lib);
2833 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
2834
2835 const char* kReloadScript =
2836 "class A{\n"
2837 " var x, y, z;\n"
2838 "}\n"
2839 "var a, hash1, hash2;\n"
2840 "main() {\n"
2841 " hash2 = a.hashCode;\n"
2842 " return (hash1 == hash2).toString();\n"
2843 "}\n";
2844
2845 lib = TestCase::ReloadTestScript(kReloadScript);
2846 EXPECT_VALID(lib);
2847 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
2848 }
2849
2850
2851 TEST_CASE(IsolateReload_StaticTearOffRetainsHash) {
2852 const char* kScript =
2853 "foo() {}\n"
2854 "var hash1, hash2;\n"
2855 "main() {\n"
2856 " hash1 = foo.hashCode;\n"
2857 " return 'okay';\n"
2858 "}\n";
2859
2860 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2861 EXPECT_VALID(lib);
2862 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
2863
2864 const char* kReloadScript =
2865 "foo() {}\n"
2866 "var hash1, hash2;\n"
2867 "main() {\n"
2868 " hash2 = foo.hashCode;\n"
2869 " return (hash1 == hash2).toString();\n"
2870 "}\n";
2871
2872 lib = TestCase::ReloadTestScript(kReloadScript);
2873 EXPECT_VALID(lib);
2874 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
2875 }
2876
2877
2819 static bool NothingModifiedCallback(const char* url, int64_t since) { 2878 static bool NothingModifiedCallback(const char* url, int64_t since) {
2820 return false; 2879 return false;
2821 } 2880 }
2822 2881
2823 2882
2824 TEST_CASE(IsolateReload_NoLibsModified) { 2883 TEST_CASE(IsolateReload_NoLibsModified) {
2825 const char* kImportScript = 2884 const char* kImportScript =
2826 "importedFunc() => 'fancy';"; 2885 "importedFunc() => 'fancy';";
2827 TestCase::AddTestLib("test:lib1", kImportScript); 2886 TestCase::AddTestLib("test:lib1", kImportScript);
2828 2887
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3020 EXPECT_VALID(lib); 3079 EXPECT_VALID(lib);
3021 Dart_SetFileModifiedCallback(NULL); 3080 Dart_SetFileModifiedCallback(NULL);
3022 3081
3023 // Modification of an exported library propagates. 3082 // Modification of an exported library propagates.
3024 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); 3083 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main"));
3025 } 3084 }
3026 3085
3027 #endif // !PRODUCT 3086 #endif // !PRODUCT
3028 3087
3029 } // namespace dart 3088 } // namespace dart
OLDNEW
« runtime/vm/become.cc ('K') | « runtime/vm/become.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698