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

Side by Side Diff: tests/lib/convert/utf82_test.dart

Issue 19941002: Remove dart:codec and move classes into dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 | « tests/lib/convert/codec2_test.dart ('k') | tests/lib/convert/utf83_test.dart » ('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 library utf8_test; 5 library utf8_test;
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:codec';
9 8
10 String decode(List<int> bytes) => new Utf8Decoder().convert(bytes); 9 String decode(List<int> bytes) => new Utf8Decoder().convert(bytes);
11 String decodeAllowMalformed(List<int> bytes) { 10 String decodeAllowMalformed(List<int> bytes) {
12 return new Utf8Decoder(allowMalformed: true).convert(bytes); 11 return new Utf8Decoder(allowMalformed: true).convert(bytes);
13 } 12 }
14 13
15 String decode2(List<int> bytes) => UTF8.decode(bytes); 14 String decode2(List<int> bytes) => UTF8.decode(bytes);
16 String decodeAllowMalformed2(List<int> bytes) { 15 String decodeAllowMalformed2(List<int> bytes) {
17 return UTF8.decode(bytes, allowMalformed: true); 16 return UTF8.decode(bytes, allowMalformed: true);
18 } 17 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 Expect.throws(() => decode3(bytes), (e) => e is FormatException); 125 Expect.throws(() => decode3(bytes), (e) => e is FormatException);
127 Expect.throws(() => decode4(bytes), (e) => e is FormatException); 126 Expect.throws(() => decode4(bytes), (e) => e is FormatException);
128 127
129 String expected = test[1]; 128 String expected = test[1];
130 Expect.equals(expected, decodeAllowMalformed(bytes)); 129 Expect.equals(expected, decodeAllowMalformed(bytes));
131 Expect.equals(expected, decodeAllowMalformed2(bytes)); 130 Expect.equals(expected, decodeAllowMalformed2(bytes));
132 Expect.equals(expected, decodeAllowMalformed3(bytes)); 131 Expect.equals(expected, decodeAllowMalformed3(bytes));
133 Expect.equals(expected, decodeAllowMalformed4(bytes)); 132 Expect.equals(expected, decodeAllowMalformed4(bytes));
134 } 133 }
135 } 134 }
OLDNEW
« no previous file with comments | « tests/lib/convert/codec2_test.dart ('k') | tests/lib/convert/utf83_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698