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

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

Issue 8528018: Start checking inputs to dart api functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_api_state.h" 9 #include "vm/dart_api_state.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 static Dart_Handle library_handler(Dart_LibraryTag tag, 2018 static Dart_Handle library_handler(Dart_LibraryTag tag,
2019 Dart_Handle library, 2019 Dart_Handle library,
2020 Dart_Handle url) { 2020 Dart_Handle url) {
2021 if (tag == kCanonicalizeUrl) { 2021 if (tag == kCanonicalizeUrl) {
2022 return url; 2022 return url;
2023 } 2023 }
2024 return Api::Success(); 2024 return Api::Success();
2025 } 2025 }
2026 2026
2027 2027
2028 UNIT_TEST_CASE(LoadScript) {
2029 const char* kScriptChars =
2030 "main() {"
2031 " return 12345;"
2032 "}";
2033
2034 Dart_CreateIsolate(NULL, NULL);
2035 Dart_EnterScope();
2036
2037 Dart_Handle url = Dart_NewString(TestCase::url());
2038 Dart_Handle source = Dart_NewString(kScriptChars);
2039 Dart_Handle error = Dart_Error("incoming error");
2040 Dart_Handle result;
2041
2042 result = Dart_LoadScript(Dart_Null(), source, library_handler);
2043 EXPECT(Dart_IsError(result));
2044 EXPECT_STREQ("Dart_LoadScript expects argument 'url' to be non-null.",
2045 Dart_GetError(result));
2046
2047 result = Dart_LoadScript(Dart_True(), source, library_handler);
2048 EXPECT(Dart_IsError(result));
2049 EXPECT_STREQ("Dart_LoadScript expects argument 'url' to be of type String.",
2050 Dart_GetError(result));
2051
2052 result = Dart_LoadScript(error, source, library_handler);
2053 EXPECT(Dart_IsError(result));
2054 EXPECT_STREQ("incoming error", Dart_GetError(result));
2055
2056 result = Dart_LoadScript(url, Dart_Null(), library_handler);
2057 EXPECT(Dart_IsError(result));
2058 EXPECT_STREQ("Dart_LoadScript expects argument 'source' to be non-null.",
2059 Dart_GetError(result));
2060
2061 result = Dart_LoadScript(url, Dart_True(), library_handler);
2062 EXPECT(Dart_IsError(result));
2063 EXPECT_STREQ(
2064 "Dart_LoadScript expects argument 'source' to be of type String.",
2065 Dart_GetError(result));
2066
2067 result = Dart_LoadScript(url, error, library_handler);
2068 EXPECT(Dart_IsError(result));
2069 EXPECT_STREQ("incoming error", Dart_GetError(result));
2070
2071 // Load a script successfully.
2072 result = Dart_LoadScript(url, source, library_handler);
2073 EXPECT_VALID(result);
2074
2075 result = Dart_InvokeStatic(result,
2076 Dart_NewString(""),
2077 Dart_NewString("main"),
2078 0,
2079 NULL);
2080 EXPECT_VALID(result);
2081 EXPECT(Dart_IsInteger(result));
2082 int64_t value = 0;
2083 EXPECT_VALID(Dart_IntegerValue(result, &value));
2084 EXPECT_EQ(12345, value);
2085
2086 // Further calls to LoadScript are errors.
2087 result = Dart_LoadScript(url, source, library_handler);
2088 EXPECT(Dart_IsError(result));
2089 EXPECT_STREQ("Dart_LoadScript: "
2090 "A script has already been loaded from 'dart:test-lib'.",
2091 Dart_GetError(result));
2092
2093 Dart_ExitScope();
2094 Dart_ShutdownIsolate();
2095 }
2096
2097
2098 UNIT_TEST_CASE(LoadScript_CompileError) {
2099 const char* kScriptChars =
2100 ")";
2101
2102 Dart_CreateIsolate(NULL, NULL);
2103 Dart_EnterScope();
2104
2105 Dart_Handle url = Dart_NewString(TestCase::url());
2106 Dart_Handle source = Dart_NewString(kScriptChars);
2107 Dart_Handle result = Dart_LoadScript(url, source, library_handler);
2108 EXPECT(Dart_IsError(result));
2109 EXPECT(strstr(Dart_GetError(result), "unexpected token ')'"));
2110
2111 Dart_ExitScope();
2112 Dart_ShutdownIsolate();
2113 }
2114
2115
2028 UNIT_TEST_CASE(LookupLibrary) { 2116 UNIT_TEST_CASE(LookupLibrary) {
2029 const char* kScriptChars = 2117 const char* kScriptChars =
2030 "#import('library1.dart');" 2118 "#import('library1.dart');"
2031 "main() {}"; 2119 "main() {}";
2032 const char* kLibrary1Chars = 2120 const char* kLibrary1Chars =
2033 "#library('library1.dart');" 2121 "#library('library1.dart');"
2034 "#import('library2.dart');"; 2122 "#import('library2.dart');";
2035 2123
2036 Dart_CreateIsolate(NULL, NULL); 2124 Dart_CreateIsolate(NULL, NULL);
2037 Dart_EnterScope(); 2125 Dart_EnterScope();
(...skipping 16 matching lines...) Expand all
2054 EXPECT(Dart_IsError(result)); 2142 EXPECT(Dart_IsError(result));
2055 EXPECT_STREQ("Dart_LookupLibrary expects argument 'url' to be non-null.", 2143 EXPECT_STREQ("Dart_LookupLibrary expects argument 'url' to be non-null.",
2056 Dart_GetError(result)); 2144 Dart_GetError(result));
2057 2145
2058 result = Dart_LookupLibrary(Dart_True()); 2146 result = Dart_LookupLibrary(Dart_True());
2059 EXPECT(Dart_IsError(result)); 2147 EXPECT(Dart_IsError(result));
2060 EXPECT_STREQ( 2148 EXPECT_STREQ(
2061 "Dart_LookupLibrary expects argument 'url' to be of type String.", 2149 "Dart_LookupLibrary expects argument 'url' to be of type String.",
2062 Dart_GetError(result)); 2150 Dart_GetError(result));
2063 2151
2064 result = Dart_LookupLibrary(Dart_Error("incoming error pass-thru")); 2152 result = Dart_LookupLibrary(Dart_Error("incoming error"));
2065 EXPECT(Dart_IsError(result)); 2153 EXPECT(Dart_IsError(result));
2066 EXPECT_STREQ("incoming error pass-thru", Dart_GetError(result)); 2154 EXPECT_STREQ("incoming error", Dart_GetError(result));
2067 2155
2068 url = Dart_NewString("noodles.dart"); 2156 url = Dart_NewString("noodles.dart");
2069 result = Dart_LookupLibrary(url); 2157 result = Dart_LookupLibrary(url);
2070 EXPECT(Dart_IsError(result)); 2158 EXPECT(Dart_IsError(result));
2071 EXPECT_STREQ("Dart_LookupLibrary: library 'noodles.dart' not found.", 2159 EXPECT_STREQ("Dart_LookupLibrary: library 'noodles.dart' not found.",
2072 Dart_GetError(result)); 2160 Dart_GetError(result));
2073 2161
2074 Dart_ExitScope(); 2162 Dart_ExitScope();
2075 Dart_ShutdownIsolate(); 2163 Dart_ShutdownIsolate();
2076 } 2164 }
2077 2165
2078 2166
2167 UNIT_TEST_CASE(LibraryUrl) {
2168 const char* kLibrary1Chars =
2169 "#library('library1_name');";
2170
2171 Dart_CreateIsolate(NULL, NULL);
2172 Dart_EnterScope();
2173
2174 Dart_Handle url = Dart_NewString("library1_url");
2175 Dart_Handle source = Dart_NewString(kLibrary1Chars);
2176 Dart_Handle lib = Dart_LoadLibrary(url, source);
2177 Dart_Handle error = Dart_Error("incoming error");
2178 EXPECT_VALID(lib);
2179
2180 Dart_Handle result = Dart_LibraryUrl(Dart_Null());
2181 EXPECT(Dart_IsError(result));
2182 EXPECT_STREQ("Dart_LibraryUrl expects argument 'library' to be non-null.",
2183 Dart_GetError(result));
2184
2185 result = Dart_LibraryUrl(Dart_True());
2186 EXPECT(Dart_IsError(result));
2187 EXPECT_STREQ(
2188 "Dart_LibraryUrl expects argument 'library' to be of type Library.",
2189 Dart_GetError(result));
2190
2191 result = Dart_LibraryUrl(error);
2192 EXPECT(Dart_IsError(result));
2193 EXPECT_STREQ("incoming error", Dart_GetError(result));
2194
2195 result = Dart_LibraryUrl(lib);
2196 EXPECT_VALID(result);
2197 EXPECT(Dart_IsString(result));
2198 const char* cstr = NULL;
2199 EXPECT_VALID(Dart_StringToCString(result, &cstr));
2200 EXPECT_STREQ("library1_url", cstr);
2201
2202 Dart_ExitScope();
2203 Dart_ShutdownIsolate();
2204 }
2205
2206
2207 UNIT_TEST_CASE(LibraryImportLibrary) {
2208 const char* kLibrary1Chars =
2209 "#library('library1_name');";
2210 const char* kLibrary2Chars =
2211 "#library('library2_name');";
2212
2213 Dart_CreateIsolate(NULL, NULL);
2214 Dart_EnterScope();
2215
2216 Dart_Handle error = Dart_Error("incoming error");
2217 Dart_Handle result;
2218
2219 Dart_Handle url = Dart_NewString("library1_url");
2220 Dart_Handle source = Dart_NewString(kLibrary1Chars);
2221 Dart_Handle lib1 = Dart_LoadLibrary(url, source);
2222 EXPECT_VALID(lib1);
2223
2224 url = Dart_NewString("library2_url");
2225 source = Dart_NewString(kLibrary2Chars);
2226 Dart_Handle lib2 = Dart_LoadLibrary(url, source);
2227 EXPECT_VALID(lib2);
2228
2229 result = Dart_LibraryImportLibrary(Dart_Null(), lib2);
2230 EXPECT(Dart_IsError(result));
2231 EXPECT_STREQ(
2232 "Dart_LibraryImportLibrary expects argument 'library' to be non-null.",
2233 Dart_GetError(result));
2234
2235 result = Dart_LibraryImportLibrary(Dart_True(), lib2);
2236 EXPECT(Dart_IsError(result));
2237 EXPECT_STREQ("Dart_LibraryImportLibrary expects argument 'library' to be of "
2238 "type Library.",
2239 Dart_GetError(result));
2240
2241 result = Dart_LibraryImportLibrary(error, lib2);
2242 EXPECT(Dart_IsError(result));
2243 EXPECT_STREQ("incoming error", Dart_GetError(result));
2244
2245 result = Dart_LibraryImportLibrary(lib1, Dart_Null());
2246 EXPECT(Dart_IsError(result));
2247 EXPECT_STREQ(
2248 "Dart_LibraryImportLibrary expects argument 'import' to be non-null.",
2249 Dart_GetError(result));
2250
2251 result = Dart_LibraryImportLibrary(lib1, Dart_True());
2252 EXPECT(Dart_IsError(result));
2253 EXPECT_STREQ("Dart_LibraryImportLibrary expects argument 'import' to be of "
2254 "type Library.",
2255 Dart_GetError(result));
2256
2257 result = Dart_LibraryImportLibrary(lib1, error);
2258 EXPECT(Dart_IsError(result));
2259 EXPECT_STREQ("incoming error", Dart_GetError(result));
2260
2261 result = Dart_LibraryImportLibrary(lib1, lib2);
2262 EXPECT_VALID(result);
2263
2264 Dart_ExitScope();
2265 Dart_ShutdownIsolate();
2266 }
2267
2268
2269
2270 UNIT_TEST_CASE(LoadLibrary) {
2271 const char* kLibrary1Chars =
2272 "#library('library1_name');";
2273
2274 Dart_CreateIsolate(NULL, NULL);
2275 Dart_EnterScope();
2276
2277 Dart_Handle error = Dart_Error("incoming error");
2278 Dart_Handle result;
2279
2280 Dart_Handle url = Dart_NewString("library1_url");
2281 Dart_Handle source = Dart_NewString(kLibrary1Chars);
2282
2283 result = Dart_LoadLibrary(Dart_Null(), source);
2284 EXPECT(Dart_IsError(result));
2285 EXPECT_STREQ("Dart_LoadLibrary expects argument 'url' to be non-null.",
2286 Dart_GetError(result));
2287
2288 result = Dart_LoadLibrary(Dart_True(), source);
2289 EXPECT(Dart_IsError(result));
2290 EXPECT_STREQ("Dart_LoadLibrary expects argument 'url' to be of type String.",
2291 Dart_GetError(result));
2292
2293 result = Dart_LoadLibrary(error, source);
2294 EXPECT(Dart_IsError(result));
2295 EXPECT_STREQ("incoming error", Dart_GetError(result));
2296
2297 result = Dart_LoadLibrary(url, Dart_Null());
2298 EXPECT(Dart_IsError(result));
2299 EXPECT_STREQ("Dart_LoadLibrary expects argument 'source' to be non-null.",
2300 Dart_GetError(result));
2301
2302 result = Dart_LoadLibrary(url, Dart_True());
2303 EXPECT(Dart_IsError(result));
2304 EXPECT_STREQ(
2305 "Dart_LoadLibrary expects argument 'source' to be of type String.",
2306 Dart_GetError(result));
2307
2308 result = Dart_LoadLibrary(url, error);
2309 EXPECT(Dart_IsError(result));
2310 EXPECT_STREQ("incoming error", Dart_GetError(result));
2311
2312 // Success.
2313 result = Dart_LoadLibrary(url, source);
2314 EXPECT_VALID(result);
2315 EXPECT(Dart_IsLibrary(result));
2316
2317 // Duplicate library load fails.
2318 result = Dart_LoadLibrary(url, source);
2319 EXPECT(Dart_IsError(result));
2320 EXPECT_STREQ(
2321 "Dart_LoadLibrary: library 'library1_url' has already been loaded.",
2322 Dart_GetError(result));
2323
2324 Dart_ExitScope();
2325 Dart_ShutdownIsolate();
2326 }
2327
2328
2329 UNIT_TEST_CASE(LoadLibrary_CompileError) {
2330 const char* kLibrary1Chars =
2331 "#library('library1_name');"
2332 ")";
2333
2334 Dart_CreateIsolate(NULL, NULL);
2335 Dart_EnterScope();
2336
2337 Dart_Handle url = Dart_NewString("library1_url");
2338 Dart_Handle source = Dart_NewString(kLibrary1Chars);
2339 Dart_Handle result = Dart_LoadLibrary(url, source);
2340 EXPECT(Dart_IsError(result));
2341 EXPECT(strstr(Dart_GetError(result), "unexpected token ')'"));
2342
2343 Dart_ExitScope();
2344 Dart_ShutdownIsolate();
2345 }
2346
2347
2348 UNIT_TEST_CASE(LoadSource) {
2349 const char* kLibrary1Chars =
2350 "#library('library1_name');";
2351 const char* kSourceChars =
2352 "// Something innocuous";
2353 const char* kBadSourceChars =
2354 ")";
2355
2356 Dart_CreateIsolate(NULL, NULL);
2357 Dart_EnterScope();
2358
2359 Dart_Handle error = Dart_Error("incoming error");
2360 Dart_Handle result;
2361
2362 // Load up a library.
2363 Dart_Handle url = Dart_NewString("library1_url");
2364 Dart_Handle source = Dart_NewString(kLibrary1Chars);
2365 Dart_Handle lib = Dart_LoadLibrary(url, source);
2366 EXPECT_VALID(lib);
2367 EXPECT(Dart_IsLibrary(lib));
2368
2369 url = Dart_NewString("source_url");
2370 source = Dart_NewString(kSourceChars);
2371
2372 result = Dart_LoadSource(Dart_Null(), url, source);
2373 EXPECT(Dart_IsError(result));
2374 EXPECT_STREQ("Dart_LoadSource expects argument 'library' to be non-null.",
2375 Dart_GetError(result));
2376
2377 result = Dart_LoadSource(Dart_True(), url, source);
2378 EXPECT(Dart_IsError(result));
2379 EXPECT_STREQ(
2380 "Dart_LoadSource expects argument 'library' to be of type Library.",
2381 Dart_GetError(result));
2382
2383 result = Dart_LoadSource(error, url, source);
2384 EXPECT(Dart_IsError(result));
2385 EXPECT_STREQ("incoming error", Dart_GetError(result));
2386
2387 result = Dart_LoadSource(lib, Dart_Null(), source);
2388 EXPECT(Dart_IsError(result));
2389 EXPECT_STREQ("Dart_LoadSource expects argument 'url' to be non-null.",
2390 Dart_GetError(result));
2391
2392 result = Dart_LoadSource(lib, Dart_True(), source);
2393 EXPECT(Dart_IsError(result));
2394 EXPECT_STREQ("Dart_LoadSource expects argument 'url' to be of type String.",
2395 Dart_GetError(result));
2396
2397 result = Dart_LoadSource(lib, error, source);
2398 EXPECT(Dart_IsError(result));
2399 EXPECT_STREQ("incoming error", Dart_GetError(result));
2400
2401 result = Dart_LoadSource(lib, url, Dart_Null());
2402 EXPECT(Dart_IsError(result));
2403 EXPECT_STREQ("Dart_LoadSource expects argument 'source' to be non-null.",
2404 Dart_GetError(result));
2405
2406 result = Dart_LoadSource(lib, url, Dart_True());
2407 EXPECT(Dart_IsError(result));
2408 EXPECT_STREQ(
2409 "Dart_LoadSource expects argument 'source' to be of type String.",
2410 Dart_GetError(result));
2411
2412 result = Dart_LoadSource(lib, error, source);
2413 EXPECT(Dart_IsError(result));
2414 EXPECT_STREQ("incoming error", Dart_GetError(result));
2415
2416 // Success.
2417 result = Dart_LoadSource(lib, url, source);
2418 EXPECT_VALID(result);
2419 EXPECT(Dart_IsLibrary(result));
2420 bool same = false;
2421 EXPECT_VALID(Dart_IsSame(lib, result, &same));
2422 EXPECT(same);
2423
2424 // Duplicate calls are okay.
2425 result = Dart_LoadSource(lib, url, source);
2426 EXPECT_VALID(result);
2427 EXPECT(Dart_IsLibrary(result));
2428 same = false;
2429 EXPECT_VALID(Dart_IsSame(lib, result, &same));
2430 EXPECT(same);
2431
2432 // Language errors are detected.
2433 source = Dart_NewString(kBadSourceChars);
2434 result = Dart_LoadSource(lib, url, source);
2435 EXPECT(Dart_IsError(result));
2436
2437 Dart_ExitScope();
2438 Dart_ShutdownIsolate();
2439 }
2440
2441
2442 static void MyNativeFunction1(Dart_NativeArguments args) {
2443 Dart_EnterScope();
2444 Dart_SetReturnValue(args, Dart_NewInteger(654321));
2445 Dart_ExitScope();
2446 }
2447
2448
2449 static void MyNativeFunction2(Dart_NativeArguments args) {
2450 Dart_EnterScope();
2451 Dart_SetReturnValue(args, Dart_NewInteger(123456));
2452 Dart_ExitScope();
2453 }
2454
2455
2456 static Dart_NativeFunction MyNativeResolver1(Dart_Handle name,
2457 int arg_count) {
2458 return &MyNativeFunction1;
2459 }
2460
2461
2462 static Dart_NativeFunction MyNativeResolver2(Dart_Handle name,
2463 int arg_count) {
2464 return &MyNativeFunction2;
2465 }
2466
2467
2468 UNIT_TEST_CASE(SetNativeResolver) {
2469 const char* kScriptChars =
2470 "class Test {"
2471 " static foo() native \"SomeNativeFunction\";"
2472 " static bar() native \"SomeNativeFunction2\";"
2473 " static baz() native \"SomeNativeFunction3\";"
2474 "}";
2475
2476 Dart_CreateIsolate(NULL, NULL);
2477 Dart_EnterScope();
2478
2479 Dart_Handle error = Dart_Error("incoming error");
2480 Dart_Handle result;
2481
2482 // Load a test script.
2483 Dart_Handle url = Dart_NewString(TestCase::url());
2484 Dart_Handle source = Dart_NewString(kScriptChars);
2485 Dart_Handle lib = Dart_LoadScript(url, source, library_handler);
2486 EXPECT_VALID(lib);
2487 EXPECT(Dart_IsLibrary(lib));
2488
2489 result = Dart_SetNativeResolver(Dart_Null(), &MyNativeResolver1);
2490 EXPECT(Dart_IsError(result));
2491 EXPECT_STREQ(
2492 "Dart_SetNativeResolver expects argument 'library' to be non-null.",
2493 Dart_GetError(result));
2494
2495 result = Dart_SetNativeResolver(Dart_True(), &MyNativeResolver1);
2496 EXPECT(Dart_IsError(result));
2497 EXPECT_STREQ("Dart_SetNativeResolver expects argument 'library' to be of "
2498 "type Library.",
2499 Dart_GetError(result));
2500
2501 result = Dart_SetNativeResolver(error, &MyNativeResolver1);
2502 EXPECT(Dart_IsError(result));
2503 EXPECT_STREQ("incoming error", Dart_GetError(result));
2504
2505 result = Dart_SetNativeResolver(lib, &MyNativeResolver1);
2506 EXPECT_VALID(result);
2507
2508 // Call a function and make sure native resolution works.
2509 result = Dart_InvokeStatic(lib,
2510 Dart_NewString("Test"),
2511 Dart_NewString("foo"),
2512 0,
2513 NULL);
2514 EXPECT_VALID(result);
2515 EXPECT(Dart_IsInteger(result));
2516 int64_t value = 0;
2517 EXPECT_VALID(Dart_IntegerValue(result, &value));
2518 EXPECT_EQ(654321, value);
2519
2520 // A second call succeeds.
2521 result = Dart_SetNativeResolver(lib, &MyNativeResolver2);
2522 EXPECT_VALID(result);
2523
2524 // 'foo' has already been resolved so gets the old value.
2525 result = Dart_InvokeStatic(lib,
2526 Dart_NewString("Test"),
2527 Dart_NewString("foo"),
2528 0,
2529 NULL);
2530 EXPECT_VALID(result);
2531 EXPECT(Dart_IsInteger(result));
2532 value = 0;
2533 EXPECT_VALID(Dart_IntegerValue(result, &value));
2534 EXPECT_EQ(654321, value);
2535
2536 // 'bar' has not yet been resolved so gets the new value.
2537 result = Dart_InvokeStatic(lib,
2538 Dart_NewString("Test"),
2539 Dart_NewString("bar"),
2540 0,
2541 NULL);
2542 EXPECT_VALID(result);
2543 EXPECT(Dart_IsInteger(result));
2544 value = 0;
2545 EXPECT_VALID(Dart_IntegerValue(result, &value));
2546 EXPECT_EQ(123456, value);
2547
2548 // A NULL resolver is okay, but resolution will fail.
2549 result = Dart_SetNativeResolver(lib, NULL);
2550 EXPECT_VALID(result);
2551
2552 result = Dart_InvokeStatic(lib,
2553 Dart_NewString("Test"),
2554 Dart_NewString("baz"),
2555 0,
2556 NULL);
2557 EXPECT(Dart_IsError(result));
2558 EXPECT(strstr(Dart_GetError(result),
2559 "native function 'SomeNativeFunction3' cannot be found"));
2560
2561 Dart_ExitScope();
2562 Dart_ShutdownIsolate();
2563 }
2564
2565
2079 UNIT_TEST_CASE(ImportLibrary1) { 2566 UNIT_TEST_CASE(ImportLibrary1) {
2080 const char* kScriptChars = 2567 const char* kScriptChars =
2081 "#import('library1.dart');" 2568 "#import('library1.dart');"
2082 "#import('library2.dart');" 2569 "#import('library2.dart');"
2083 "var foo; // library2 defines foo, so should be error." 2570 "var foo; // library2 defines foo, so should be error."
2084 "main() {}"; 2571 "main() {}";
2085 const char* kLibrary1Chars = 2572 const char* kLibrary1Chars =
2086 "#library('library1.dart');" 2573 "#library('library1.dart');"
2087 "#import('library2.dart');" 2574 "#import('library2.dart');"
2088 "var foo1;"; 2575 "var foo1;";
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 NULL); 2819 NULL);
2333 EXPECT_VALID(result); 2820 EXPECT_VALID(result);
2334 2821
2335 Dart_ExitScope(); // Exit the Dart API scope. 2822 Dart_ExitScope(); // Exit the Dart API scope.
2336 } 2823 }
2337 Dart_ShutdownIsolate(); 2824 Dart_ShutdownIsolate();
2338 } 2825 }
2339 #endif // TARGET_ARCH_IA32. 2826 #endif // TARGET_ARCH_IA32.
2340 2827
2341 } // namespace dart 2828 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698