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 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 String& str = String::Handle(script.url()); | 2206 String& str = String::Handle(script.url()); |
2207 EXPECT_EQ(17, str.Length()); | 2207 EXPECT_EQ(17, str.Length()); |
2208 EXPECT_EQ('b', str.CharAt(0)); | 2208 EXPECT_EQ('b', str.CharAt(0)); |
2209 EXPECT_EQ(':', str.CharAt(7)); | 2209 EXPECT_EQ(':', str.CharAt(7)); |
2210 EXPECT_EQ('e', str.CharAt(16)); | 2210 EXPECT_EQ('e', str.CharAt(16)); |
2211 str = script.Source(); | 2211 str = script.Source(); |
2212 EXPECT_EQ(22, str.Length()); | 2212 EXPECT_EQ(22, str.Length()); |
2213 EXPECT_EQ('T', str.CharAt(0)); | 2213 EXPECT_EQ('T', str.CharAt(0)); |
2214 EXPECT_EQ('n', str.CharAt(10)); | 2214 EXPECT_EQ('n', str.CharAt(10)); |
2215 EXPECT_EQ('.', str.CharAt(21)); | 2215 EXPECT_EQ('.', str.CharAt(21)); |
| 2216 |
| 2217 const char* kScript = "main() {}"; |
| 2218 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, NULL); |
| 2219 EXPECT_VALID(h_lib); |
| 2220 Library& lib = Library::Handle(); |
| 2221 lib ^= Api::UnwrapHandle(h_lib); |
| 2222 EXPECT(!lib.IsNull()); |
| 2223 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL); |
| 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()); |
2216 } | 2232 } |
2217 | 2233 |
2218 | 2234 |
2219 TEST_CASE(EmbeddedScript) { | 2235 TEST_CASE(EmbeddedScript) { |
2220 const char* url_chars = "builtin:test-case"; | 2236 const char* url_chars = "builtin:test-case"; |
2221 const char* text = | 2237 const char* text = |
2222 /* 1 */ "<!DOCTYPE html>\n" | 2238 /* 1 */ "<!DOCTYPE html>\n" |
2223 /* 2 */ " ... more junk ...\n" | 2239 /* 2 */ " ... more junk ...\n" |
2224 /* 3 */ " <script type='application/dart'>main() {\n" | 2240 /* 3 */ " <script type='application/dart'>main() {\n" |
2225 /* 4 */ " return 'foo';\n" | 2241 /* 4 */ " return 'foo';\n" |
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4068 const Instance& a0 = Instance::Handle(Instance::New(clazz)); | 4084 const Instance& a0 = Instance::Handle(Instance::New(clazz)); |
4069 const Instance& a1 = Instance::Handle(Instance::New(clazz)); | 4085 const Instance& a1 = Instance::Handle(Instance::New(clazz)); |
4070 EXPECT(a0.raw() != a1.raw()); | 4086 EXPECT(a0.raw() != a1.raw()); |
4071 EXPECT(a0.OperatorEquals(a0)); | 4087 EXPECT(a0.OperatorEquals(a0)); |
4072 EXPECT(a0.OperatorEquals(a1)); | 4088 EXPECT(a0.OperatorEquals(a1)); |
4073 EXPECT(a0.IsIdenticalTo(a0)); | 4089 EXPECT(a0.IsIdenticalTo(a0)); |
4074 EXPECT(!a0.IsIdenticalTo(a1)); | 4090 EXPECT(!a0.IsIdenticalTo(a1)); |
4075 } | 4091 } |
4076 | 4092 |
4077 } // namespace dart | 4093 } // namespace dart |
OLD | NEW |