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

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

Issue 460233005: Fix one missing invalid encoding case. (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') | 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 "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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::DecodeIRI(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(StringDecodeIRIInvalid) { 430 TEST_CASE(StringDecodeIRIInvalid) {
431 String& input = String::Handle(); 431 String& input = String::Handle();
432 input = String::New("file%"); 432 input = String::New("file%");
433 EXPECT(String::DecodeIRI(input) == String::null()); 433 String& decoded = String::Handle();
434 decoded = String::DecodeIRI(input);
435 EXPECT(decoded.IsNull());
434 input = String::New("file%3"); 436 input = String::New("file%3");
435 EXPECT(String::DecodeIRI(input) == String::null()); 437 decoded = String::DecodeIRI(input);
438 EXPECT(decoded.IsNull());
436 input = String::New("file%3g"); 439 input = String::New("file%3g");
437 EXPECT(String::DecodeIRI(input) == String::null()); 440 decoded = String::DecodeIRI(input);
441 EXPECT(decoded.IsNull());
438 } 442 }
439 443
440 444
441 TEST_CASE(StringIRITwoByte) { 445 TEST_CASE(StringIRITwoByte) {
442 const intptr_t kInputLen = 3; 446 const intptr_t kInputLen = 3;
443 const uint16_t kInput[kInputLen] = { 'x', '/', 256 }; 447 const uint16_t kInput[kInputLen] = { 'x', '/', 256 };
444 const String& input = String::Handle(String::FromUTF16(kInput, kInputLen)); 448 const String& input = String::Handle(String::FromUTF16(kInput, kInputLen));
445 const intptr_t kOutputLen = 10; 449 const intptr_t kOutputLen = 10;
446 const uint16_t kOutput[kOutputLen] = 450 const uint16_t kOutput[kOutputLen] =
447 { 'x', '%', '2', 'F', '%', 'C', '4', '%', '8', '0' }; 451 { 'x', '%', '2', 'F', '%', 'C', '4', '%', '8', '0' };
(...skipping 3793 matching lines...) Expand 10 before | Expand all | Expand 10 after
4241 EXPECT_VALID(h_result); 4245 EXPECT_VALID(h_result);
4242 Integer& result = Integer::Handle(); 4246 Integer& result = Integer::Handle();
4243 result ^= Api::UnwrapHandle(h_result); 4247 result ^= Api::UnwrapHandle(h_result);
4244 String& foo = String::Handle(String::New("foo")); 4248 String& foo = String::Handle(String::New("foo"));
4245 Integer& expected = Integer::Handle(); 4249 Integer& expected = Integer::Handle();
4246 expected ^= foo.HashCode(); 4250 expected ^= foo.HashCode();
4247 EXPECT(result.IsIdenticalTo(expected)); 4251 EXPECT(result.IsIdenticalTo(expected));
4248 } 4252 }
4249 4253
4250 } // namespace dart 4254 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698