Index: runtime/vm/object_test.cc |
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc |
index 5cd2749a67fb6b3a45a1e890b4e39928ebf198af..e7b69f62b861ae1060e4bbc57e92d5c133b27cf0 100644 |
--- a/runtime/vm/object_test.cc |
+++ b/runtime/vm/object_test.cc |
@@ -2213,6 +2213,22 @@ TEST_CASE(Script) { |
EXPECT_EQ('T', str.CharAt(0)); |
EXPECT_EQ('n', str.CharAt(10)); |
EXPECT_EQ('.', str.CharAt(21)); |
+ |
+ const char* kScript = "main() {}"; |
+ Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL); |
+ EXPECT_VALID(h_lib); |
+ Library& lib = Library::Handle(); |
+ lib ^= Api::UnwrapHandle(h_lib); |
+ EXPECT(!lib.IsNull()); |
+ Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); |
+ EXPECT_VALID(result); |
+ Script& script2 = Script::Handle( |
+ Script::FindByUrl(String::Handle(String::New("test-lib")))); |
+ EXPECT(!script2.IsNull()); |
+ const Library& lib2 = Library::Handle(script2.FindLibrary()); |
+ EXPECT_EQ(lib2.raw(), lib.raw()); |
+ script2 = Script::FindByUrl(String::Handle(String::New("non-there.dart"))); |
+ EXPECT(script2.IsNull()); |
} |