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

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

Issue 18881009: Fix for issue 11770. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months 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 | « no previous file | 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 "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "include/dart_api.h" 6 #include "include/dart_api.h"
7 #include "include/dart_mirrors_api.h" 7 #include "include/dart_mirrors_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/json.h" 10 #include "platform/json.h"
(...skipping 8013 matching lines...) Expand 10 before | Expand all | Expand 10 after
8024 8024
8025 8025
8026 TEST_CASE(ExternalizeConstantStrings) { 8026 TEST_CASE(ExternalizeConstantStrings) {
8027 const char* kScriptChars = 8027 const char* kScriptChars =
8028 "String testMain() {\n" 8028 "String testMain() {\n"
8029 " return 'constant string';\n" 8029 " return 'constant string';\n"
8030 "}\n"; 8030 "}\n";
8031 8031
8032 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 8032 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
8033 Dart_Handle result = Dart_Invoke(lib, 8033 Dart_Handle result = Dart_Invoke(lib,
8034 NewString("testMain"), 8034 NewString("testMain"),
8035 0, 8035 0,
8036 NULL); 8036 NULL);
8037 const char* expected_str = "constant string"; 8037 const char* expected_str = "constant string";
8038 const intptr_t kExpectedLen = 15; 8038 const intptr_t kExpectedLen = 15;
8039 int peer = 40;
8040 uint8_t ext_str[kExpectedLen]; 8039 uint8_t ext_str[kExpectedLen];
8041 Dart_Handle str = Dart_MakeExternalString(result, 8040 Dart_Handle str = Dart_MakeExternalString(result,
8042 ext_str, 8041 ext_str,
8043 kExpectedLen, 8042 kExpectedLen,
8044 &peer, 8043 NULL,
8045 MakeExternalCback); 8044 NULL);
8046 8045
8047 EXPECT(Dart_IsExternalString(str)); 8046 EXPECT(Dart_IsExternalString(str));
8048 for (intptr_t i = 0; i < kExpectedLen; i++) { 8047 for (intptr_t i = 0; i < kExpectedLen; i++) {
8049 EXPECT_EQ(expected_str[i], ext_str[i]); 8048 EXPECT_EQ(expected_str[i], ext_str[i]);
8050 } 8049 }
8051 } 8050 }
8052 8051
8053 8052
8054 TEST_CASE(LazyLoadDeoptimizes) { 8053 TEST_CASE(LazyLoadDeoptimizes) {
8055 const char* kLoadFirst = 8054 const char* kLoadFirst =
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
8208 NewString("main"), 8207 NewString("main"),
8209 0, 8208 0,
8210 NULL); 8209 NULL);
8211 int64_t value = 0; 8210 int64_t value = 0;
8212 result = Dart_IntegerToInt64(result, &value); 8211 result = Dart_IntegerToInt64(result, &value);
8213 EXPECT_VALID(result); 8212 EXPECT_VALID(result);
8214 EXPECT_EQ(8, value); 8213 EXPECT_EQ(8, value);
8215 } 8214 }
8216 8215
8217 } // namespace dart 8216 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698