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

Side by Side Diff: vm/snapshot_test.cc

Issue 11412048: Change the library directive syntax in the VM unit tests, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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
« no previous file with comments | « vm/isolate_test.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) 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 #include "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_message.h" 10 #include "vm/dart_api_message.h"
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 EXPECT_VALID(result); 1023 EXPECT_VALID(result);
1024 Dart_ExitScope(); 1024 Dart_ExitScope();
1025 } 1025 }
1026 Dart_ShutdownIsolate(); 1026 Dart_ShutdownIsolate();
1027 free(buffer); 1027 free(buffer);
1028 } 1028 }
1029 1029
1030 1030
1031 UNIT_TEST_CASE(ScriptSnapshot) { 1031 UNIT_TEST_CASE(ScriptSnapshot) {
1032 const char* kLibScriptChars = 1032 const char* kLibScriptChars =
1033 "#library('dart:import-lib');" 1033 "library dart_import_lib;"
1034 "class LibFields {" 1034 "class LibFields {"
1035 " LibFields(int i, int j) : fld1 = i, fld2 = j {}" 1035 " LibFields(int i, int j) : fld1 = i, fld2 = j {}"
1036 " int fld1;" 1036 " int fld1;"
1037 " final int fld2;" 1037 " final int fld2;"
1038 "}"; 1038 "}";
1039 const char* kScriptChars = 1039 const char* kScriptChars =
1040 "class Fields {" 1040 "class Fields {"
1041 " Fields(int i, int j) : fld1 = i, fld2 = j {}" 1041 " Fields(int i, int j) : fld1 = i, fld2 = j {}"
1042 " int fld1;" 1042 " int fld1;"
1043 " final int fld2;" 1043 " final int fld2;"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 Dart_ExitScope(); 1088 Dart_ExitScope();
1089 } 1089 }
1090 1090
1091 { 1091 {
1092 // Create an Isolate using the full snapshot, load a script and create 1092 // Create an Isolate using the full snapshot, load a script and create
1093 // a script snapshot of the script. 1093 // a script snapshot of the script.
1094 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); 1094 TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
1095 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 1095 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
1096 1096
1097 // Load the library. 1097 // Load the library.
1098 Dart_Handle import_lib = Dart_LoadLibrary(NewString("dart:import-lib"), 1098 Dart_Handle import_lib = Dart_LoadLibrary(NewString("dart_import_lib"),
1099 NewString(kLibScriptChars)); 1099 NewString(kLibScriptChars));
1100 EXPECT_VALID(import_lib); 1100 EXPECT_VALID(import_lib);
1101 1101
1102 // Create a test library and Load up a test script in it. 1102 // Create a test library and Load up a test script in it.
1103 TestCase::LoadTestScript(kScriptChars, NULL); 1103 TestCase::LoadTestScript(kScriptChars, NULL);
1104 1104
1105 EXPECT_VALID(Dart_LibraryImportLibrary(TestCase::lib(), 1105 EXPECT_VALID(Dart_LibraryImportLibrary(TestCase::lib(),
1106 import_lib, 1106 import_lib,
1107 Dart_Null())); 1107 Dart_Null()));
1108 1108
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 } 1694 }
1695 } 1695 }
1696 Dart_ExitScope(); 1696 Dart_ExitScope();
1697 Dart_ShutdownIsolate(); 1697 Dart_ShutdownIsolate();
1698 } 1698 }
1699 1699
1700 1700
1701 UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) { 1701 UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) {
1702 const int kArrayLength = 10; 1702 const int kArrayLength = 10;
1703 static const char* kScriptChars = 1703 static const char* kScriptChars =
1704 "#import('dart:scalarlist');\n" 1704 "import 'dart:scalarlist';\n"
1705 "final int kArrayLength = 10;\n" 1705 "final int kArrayLength = 10;\n"
1706 "getStringList() {\n" 1706 "getStringList() {\n"
1707 " var s = 'Hello, world!';\n" 1707 " var s = 'Hello, world!';\n"
1708 " var list = new List<String>(kArrayLength);\n" 1708 " var list = new List<String>(kArrayLength);\n"
1709 " for (var i = 0; i < kArrayLength; i++) list[i] = s;\n" 1709 " for (var i = 0; i < kArrayLength; i++) list[i] = s;\n"
1710 " return list;\n" 1710 " return list;\n"
1711 "}\n" 1711 "}\n"
1712 "getMintList() {\n" 1712 "getMintList() {\n"
1713 " var mint = 0x7FFFFFFFFFFFFFFF;\n" 1713 " var mint = 0x7FFFFFFFFFFFFFFF;\n"
1714 " var list = new List(kArrayLength);\n" 1714 " var list = new List(kArrayLength);\n"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 } 1865 }
1866 } 1866 }
1867 Dart_ExitScope(); 1867 Dart_ExitScope();
1868 Dart_ShutdownIsolate(); 1868 Dart_ShutdownIsolate();
1869 } 1869 }
1870 1870
1871 1871
1872 UNIT_TEST_CASE(DartGeneratedArrayLiteralMessagesWithBackref) { 1872 UNIT_TEST_CASE(DartGeneratedArrayLiteralMessagesWithBackref) {
1873 const int kArrayLength = 10; 1873 const int kArrayLength = 10;
1874 static const char* kScriptChars = 1874 static const char* kScriptChars =
1875 "#import('dart:scalarlist');\n" 1875 "import 'dart:scalarlist';\n"
1876 "final int kArrayLength = 10;\n" 1876 "final int kArrayLength = 10;\n"
1877 "getStringList() {\n" 1877 "getStringList() {\n"
1878 " var s = 'Hello, world!';\n" 1878 " var s = 'Hello, world!';\n"
1879 " var list = [s, s, s, s, s, s, s, s, s, s];\n" 1879 " var list = [s, s, s, s, s, s, s, s, s, s];\n"
1880 " return list;\n" 1880 " return list;\n"
1881 "}\n" 1881 "}\n"
1882 "getMintList() {\n" 1882 "getMintList() {\n"
1883 " var mint = 0x7FFFFFFFFFFFFFFF;\n" 1883 " var mint = 0x7FFFFFFFFFFFFFFF;\n"
1884 " var list = [mint, mint, mint, mint, mint,\n" 1884 " var list = [mint, mint, mint, mint, mint,\n"
1885 " mint, mint, mint, mint, mint];\n" 1885 " mint, mint, mint, mint, mint];\n"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 } 2041 }
2042 Dart_ExitScope(); 2042 Dart_ExitScope();
2043 Dart_ShutdownIsolate(); 2043 Dart_ShutdownIsolate();
2044 } 2044 }
2045 2045
2046 2046
2047 UNIT_TEST_CASE(PostCObject) { 2047 UNIT_TEST_CASE(PostCObject) {
2048 // Create a native port for posting from C to Dart 2048 // Create a native port for posting from C to Dart
2049 TestIsolateScope __test_isolate__; 2049 TestIsolateScope __test_isolate__;
2050 const char* kScriptChars = 2050 const char* kScriptChars =
2051 "#import('dart:isolate');\n" 2051 "import 'dart:isolate';\n"
2052 "main() {\n" 2052 "main() {\n"
2053 " var messageCount = 0;\n" 2053 " var messageCount = 0;\n"
2054 " var exception = '';\n" 2054 " var exception = '';\n"
2055 " var port = new ReceivePort();\n" 2055 " var port = new ReceivePort();\n"
2056 " port.receive((message, replyTo) {\n" 2056 " port.receive((message, replyTo) {\n"
2057 " if (messageCount < 8) {\n" 2057 " if (messageCount < 8) {\n"
2058 " exception = '$exception${message}';\n" 2058 " exception = '$exception${message}';\n"
2059 " } else {\n" 2059 " } else {\n"
2060 " exception = '$exception${message.length}';\n" 2060 " exception = '$exception${message.length}';\n"
2061 " for (int i = 0; i < message.length; i++) {\n" 2061 " for (int i = 0; i < message.length; i++) {\n"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 EXPECT(Dart_ErrorHasException(result)); 2144 EXPECT(Dart_ErrorHasException(result));
2145 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2145 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2146 Dart_GetError(result)); 2146 Dart_GetError(result));
2147 2147
2148 Dart_ExitScope(); 2148 Dart_ExitScope();
2149 } 2149 }
2150 2150
2151 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2151 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2152 2152
2153 } // namespace dart 2153 } // namespace dart
OLDNEW
« no previous file with comments | « vm/isolate_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698