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

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

Issue 466813002: Support non-ASCII script URLs in VM service by using IRIs (generalized URIs). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « runtime/vm/object.cc ('k') | runtime/vm/service.cc » ('j') | 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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 EXPECT(abce.CompareTo(monkey_face) < 0); 394 EXPECT(abce.CompareTo(monkey_face) < 0);
395 EXPECT(abcd.CompareTo(domino) < 0); 395 EXPECT(abcd.CompareTo(domino) < 0);
396 EXPECT(abce.CompareTo(domino) < 0); 396 EXPECT(abce.CompareTo(domino) < 0);
397 EXPECT(domino.CompareTo(abcd) > 0); 397 EXPECT(domino.CompareTo(abcd) > 0);
398 EXPECT(domino.CompareTo(abcd) > 0); 398 EXPECT(domino.CompareTo(abcd) > 0);
399 EXPECT(monkey_face.CompareTo(abce) > 0); 399 EXPECT(monkey_face.CompareTo(abce) > 0);
400 EXPECT(monkey_face.CompareTo(abce) > 0); 400 EXPECT(monkey_face.CompareTo(abce) > 0);
401 } 401 }
402 402
403 403
404 TEST_CASE(StringEncodeURI) { 404 TEST_CASE(StringEncodeIRI) {
405 const char* kInput = 405 const char* kInput =
406 "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart"; 406 "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart";
407 const char* kOutput = 407 const char* kOutput =
408 "file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F" 408 "file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F"
409 "dart-repo%2Fdart%2Ftest.dart"; 409 "dart-repo%2Fdart%2Ftest.dart";
410 const String& input = String::Handle(String::New(kInput)); 410 const String& input = String::Handle(String::New(kInput));
411 const String& output = String::Handle(String::New(kOutput)); 411 const String& output = String::Handle(String::New(kOutput));
412 const String& encoded = String::Handle(String::EncodeURI(input)); 412 const String& encoded = String::Handle(String::EncodeIRI(input));
413 EXPECT(output.Equals(encoded)); 413 EXPECT(output.Equals(encoded));
414 } 414 }
415 415
416 416
417 TEST_CASE(StringDecodeURI) { 417 TEST_CASE(StringDecodeIRI) {
418 const char* kOutput = 418 const char* kOutput =
419 "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart"; 419 "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart";
420 const char* kInput = 420 const char* kInput =
421 "file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F" 421 "file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F"
422 "dart-repo%2Fdart%2Ftest.dart"; 422 "dart-repo%2Fdart%2Ftest.dart";
423 const String& input = String::Handle(String::New(kInput)); 423 const String& input = String::Handle(String::New(kInput));
424 const String& output = String::Handle(String::New(kOutput)); 424 const String& output = String::Handle(String::New(kOutput));
425 const String& decoded = String::Handle(String::DecodeURI(input)); 425 const String& decoded = String::Handle(String::DecodeIRI(input));
426 EXPECT(output.Equals(decoded)); 426 EXPECT(output.Equals(decoded));
427 } 427 }
428 428
429 429
430 TEST_CASE(StringIRITwoByte) {
431 const intptr_t kInputLen = 3;
432 const uint16_t kInput[kInputLen] = { 'x', '/', 256 };
433 const String& input = String::Handle(String::FromUTF16(kInput, kInputLen));
434 const intptr_t kOutputLen = 10;
435 const uint16_t kOutput[kOutputLen] =
436 { 'x', '%', '2', 'F', '%', 'C', '4', '%', '8', '0' };
437 const String& output = String::Handle(String::FromUTF16(kOutput, kOutputLen));
438 const String& encoded = String::Handle(String::EncodeIRI(input));
439 EXPECT(output.Equals(encoded));
440 const String& decoded = String::Handle(String::DecodeIRI(output));
441 EXPECT(input.Equals(decoded));
442 }
443
444
430 TEST_CASE(Mint) { 445 TEST_CASE(Mint) {
431 // On 64-bit architectures a Smi is stored in a 64 bit word. A Midint cannot 446 // On 64-bit architectures a Smi is stored in a 64 bit word. A Midint cannot
432 // be allocated if it does fit into a Smi. 447 // be allocated if it does fit into a Smi.
433 #if !defined(ARCH_IS_64_BIT) 448 #if !defined(ARCH_IS_64_BIT)
434 { Mint& med = Mint::Handle(); 449 { Mint& med = Mint::Handle();
435 EXPECT(med.IsNull()); 450 EXPECT(med.IsNull());
436 int64_t v = DART_2PART_UINT64_C(1, 0); 451 int64_t v = DART_2PART_UINT64_C(1, 0);
437 med ^= Integer::New(v); 452 med ^= Integer::New(v);
438 EXPECT_EQ(v, med.value()); 453 EXPECT_EQ(v, med.value());
439 const String& smi_str = String::Handle(String::New("1")); 454 const String& smi_str = String::Handle(String::New("1"));
(...skipping 3775 matching lines...) Expand 10 before | Expand all | Expand 10 after
4215 EXPECT_VALID(h_result); 4230 EXPECT_VALID(h_result);
4216 Integer& result = Integer::Handle(); 4231 Integer& result = Integer::Handle();
4217 result ^= Api::UnwrapHandle(h_result); 4232 result ^= Api::UnwrapHandle(h_result);
4218 String& foo = String::Handle(String::New("foo")); 4233 String& foo = String::Handle(String::New("foo"));
4219 Integer& expected = Integer::Handle(); 4234 Integer& expected = Integer::Handle();
4220 expected ^= foo.HashCode(); 4235 expected ^= foo.HashCode();
4221 EXPECT(result.IsIdenticalTo(expected)); 4236 EXPECT(result.IsIdenticalTo(expected));
4222 } 4237 }
4223 4238
4224 } // namespace dart 4239 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698