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

Side by Side Diff: vm/dart_api_impl_test.cc

Issue 10829153: The null tests that I added for Dart_NewString{8,16,32} were too restrictive. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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 | « vm/dart_api_impl.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_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 6499 matching lines...) Expand 10 before | Expand all | Expand 10 after
6510 "expects argument 'length' to be in the range"); 6510 "expects argument 'length' to be in the range");
6511 EXPECT_ERROR(Dart_NewString16(chars16, TwoByteString::kMaxElements+1), 6511 EXPECT_ERROR(Dart_NewString16(chars16, TwoByteString::kMaxElements+1),
6512 "expects argument 'length' to be in the range"); 6512 "expects argument 'length' to be in the range");
6513 EXPECT_ERROR(Dart_NewString32(chars32, -1), 6513 EXPECT_ERROR(Dart_NewString32(chars32, -1),
6514 "expects argument 'length' to be in the range"); 6514 "expects argument 'length' to be in the range");
6515 EXPECT_ERROR(Dart_NewString32(chars32, FourByteString::kMaxElements+1), 6515 EXPECT_ERROR(Dart_NewString32(chars32, FourByteString::kMaxElements+1),
6516 "expects argument 'length' to be in the range"); 6516 "expects argument 'length' to be in the range");
6517 } 6517 }
6518 6518
6519 6519
6520 TEST_CASE(NewString_Null) {
6521 Dart_Handle str = Dart_NewString8(NULL, 0);
6522 EXPECT_VALID(str);
6523 EXPECT(Dart_IsString(str));
6524 intptr_t len = -1;
6525 EXPECT_VALID(Dart_StringLength(str, &len));
6526 EXPECT_EQ(0, len);
6527
6528 str = Dart_NewString16(NULL, 0);
6529 EXPECT_VALID(str);
6530 EXPECT(Dart_IsString(str));
6531 len = -1;
6532 EXPECT_VALID(Dart_StringLength(str, &len));
6533 EXPECT_EQ(0, len);
6534
6535 str = Dart_NewString32(NULL, 0);
6536 EXPECT_VALID(str);
6537 EXPECT(Dart_IsString(str));
6538 len = -1;
6539 EXPECT_VALID(Dart_StringLength(str, &len));
6540 EXPECT_EQ(0, len);
6541 }
6542
6543
6520 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 6544 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
6521 6545
6522 } // namespace dart 6546 } // namespace dart
OLDNEW
« no previous file with comments | « vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698