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

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

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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
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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 } 47 }
48 48
49 49
50 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, 50 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
51 Dart_Handle library, 51 Dart_Handle library,
52 Dart_Handle url) { 52 Dart_Handle url) {
53 if (!Dart_IsLibrary(library)) { 53 if (!Dart_IsLibrary(library)) {
54 return Dart_Error("not a library"); 54 return Dart_Error("not a library");
55 } 55 }
56 if (!Dart_IsString8(url)) { 56 if (!Dart_IsString(url)) {
57 return Dart_Error("url is not a string"); 57 return Dart_Error("url is not a string");
58 } 58 }
59 const char* url_chars = NULL; 59 const char* url_chars = NULL;
60 Dart_Handle result = Dart_StringToCString(url, &url_chars); 60 Dart_Handle result = Dart_StringToCString(url, &url_chars);
61 if (Dart_IsError(result)) { 61 if (Dart_IsError(result)) {
62 return Dart_Error("accessing url characters failed"); 62 return Dart_Error("accessing url characters failed");
63 } 63 }
64 bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_chars); 64 bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_chars);
65 if (tag == kCanonicalizeUrl) { 65 if (tag == kCanonicalizeUrl) {
66 // If this is a Dart Scheme URL then it is not modified as it will be 66 // If this is a Dart Scheme URL then it is not modified as it will be
(...skipping 26 matching lines...) Expand all
93 return DartUtils::LoadSource(NULL, 93 return DartUtils::LoadSource(NULL,
94 library, 94 library,
95 url, 95 url,
96 tag, 96 tag,
97 url_chars); 97 url_chars);
98 } 98 }
99 99
100 100
101 Dart_Handle TestCase::LoadTestScript(const char* script, 101 Dart_Handle TestCase::LoadTestScript(const char* script,
102 Dart_NativeEntryResolver resolver) { 102 Dart_NativeEntryResolver resolver) {
103 Dart_Handle url = Dart_NewString(TestCase::url()); 103 Dart_Handle url = NewString(TestCase::url());
104 Dart_Handle source = Dart_NewString(script); 104 Dart_Handle source = NewString(script);
105 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); 105 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler);
106 EXPECT_VALID(result); 106 EXPECT_VALID(result);
107 EXPECT_VALID(result); 107 EXPECT_VALID(result);
108 Dart_Handle lib = Dart_LoadScript(url, source); 108 Dart_Handle lib = Dart_LoadScript(url, source);
109 DART_CHECK_VALID(lib); 109 DART_CHECK_VALID(lib);
110 result = Dart_SetNativeResolver(lib, resolver); 110 result = Dart_SetNativeResolver(lib, resolver);
111 DART_CHECK_VALID(result); 111 DART_CHECK_VALID(result);
112 return lib; 112 return lib;
113 } 113 }
114 114
115 115
116 Dart_Handle TestCase::lib() { 116 Dart_Handle TestCase::lib() {
117 Dart_Handle url = Dart_NewString(TestCase::url()); 117 Dart_Handle url = NewString(TestCase::url());
118 Dart_Handle lib = Dart_LookupLibrary(url); 118 Dart_Handle lib = Dart_LookupLibrary(url);
119 DART_CHECK_VALID(lib); 119 DART_CHECK_VALID(lib);
120 ASSERT(Dart_IsLibrary(lib)); 120 ASSERT(Dart_IsLibrary(lib));
121 return lib; 121 return lib;
122 } 122 }
123 123
124 124
125 Dart_Handle TestCase::library_handler(Dart_LibraryTag tag, 125 Dart_Handle TestCase::library_handler(Dart_LibraryTag tag,
126 Dart_Handle library, 126 Dart_Handle library,
127 Dart_Handle url) { 127 Dart_Handle url) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 bool CompilerTest::TestCompileFunction(const Function& function) { 216 bool CompilerTest::TestCompileFunction(const Function& function) {
217 Isolate* isolate = Isolate::Current(); 217 Isolate* isolate = Isolate::Current();
218 ASSERT(isolate != NULL); 218 ASSERT(isolate != NULL);
219 ASSERT(ClassFinalizer::AllClassesFinalized()); 219 ASSERT(ClassFinalizer::AllClassesFinalized());
220 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 220 const Error& error = Error::Handle(Compiler::CompileFunction(function));
221 return error.IsNull(); 221 return error.IsNull();
222 } 222 }
223 223
224 } // namespace dart 224 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698