| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // TODO(zra): Remove when tests are ready to enable. | 5 // TODO(zra): Remove when tests are ready to enable. |
| 6 #include "platform/globals.h" | 6 #include "platform/globals.h" |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2215 EXPECT_EQ('.', str.CharAt(21)); | 2215 EXPECT_EQ('.', str.CharAt(21)); |
| 2216 | 2216 |
| 2217 const char* kScript = "main() {}"; | 2217 const char* kScript = "main() {}"; |
| 2218 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL); | 2218 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL); |
| 2219 EXPECT_VALID(h_lib); | 2219 EXPECT_VALID(h_lib); |
| 2220 Library& lib = Library::Handle(); | 2220 Library& lib = Library::Handle(); |
| 2221 lib ^= Api::UnwrapHandle(h_lib); | 2221 lib ^= Api::UnwrapHandle(h_lib); |
| 2222 EXPECT(!lib.IsNull()); | 2222 EXPECT(!lib.IsNull()); |
| 2223 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); | 2223 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); |
| 2224 EXPECT_VALID(result); | 2224 EXPECT_VALID(result); |
| 2225 Script& script2 = Script::Handle( | |
| 2226 Script::FindByUrl(String::Handle(String::New("test-lib")))); | |
| 2227 EXPECT(!script2.IsNull()); | |
| 2228 const Library& lib2 = Library::Handle(script2.FindLibrary()); | |
| 2229 EXPECT_EQ(lib2.raw(), lib.raw()); | |
| 2230 script2 = Script::FindByUrl(String::Handle(String::New("non-there.dart"))); | |
| 2231 EXPECT(script2.IsNull()); | |
| 2232 } | 2225 } |
| 2233 | 2226 |
| 2234 | 2227 |
| 2235 TEST_CASE(EmbeddedScript) { | 2228 TEST_CASE(EmbeddedScript) { |
| 2236 const char* url_chars = "builtin:test-case"; | 2229 const char* url_chars = "builtin:test-case"; |
| 2237 const char* text = | 2230 const char* text = |
| 2238 /* 1 */ "<!DOCTYPE html>\n" | 2231 /* 1 */ "<!DOCTYPE html>\n" |
| 2239 /* 2 */ " ... more junk ...\n" | 2232 /* 2 */ " ... more junk ...\n" |
| 2240 /* 3 */ " <script type='application/dart'>main() {\n" | 2233 /* 3 */ " <script type='application/dart'>main() {\n" |
| 2241 /* 4 */ " return 'foo';\n" | 2234 /* 4 */ " return 'foo';\n" |
| (...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4107 EXPECT_VALID(h_result); | 4100 EXPECT_VALID(h_result); |
| 4108 Integer& result = Integer::Handle(); | 4101 Integer& result = Integer::Handle(); |
| 4109 result ^= Api::UnwrapHandle(h_result); | 4102 result ^= Api::UnwrapHandle(h_result); |
| 4110 String& foo = String::Handle(String::New("foo")); | 4103 String& foo = String::Handle(String::New("foo")); |
| 4111 Integer& expected = Integer::Handle(); | 4104 Integer& expected = Integer::Handle(); |
| 4112 expected ^= foo.HashCode(); | 4105 expected ^= foo.HashCode(); |
| 4113 EXPECT(result.IsIdenticalTo(expected)); | 4106 EXPECT(result.IsIdenticalTo(expected)); |
| 4114 } | 4107 } |
| 4115 | 4108 |
| 4116 } // namespace dart | 4109 } // namespace dart |
| OLD | NEW |