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

Side by Side Diff: pkg/scheduled_test/lib/src/descriptor/file_descriptor.dart

Issue 22909059: Some more removals of dart:utf. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change ArgumentError to FormatException. Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 descriptor.file; 5 library descriptor.file;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert';
8 import 'dart:io'; 9 import 'dart:io';
9 import 'dart:math' as math; 10 import 'dart:math' as math;
10 import 'dart:utf';
11 11
12 import 'package:path/path.dart' as path; 12 import 'package:path/path.dart' as path;
13 13
14 import '../../descriptor.dart'; 14 import '../../descriptor.dart';
15 import '../../scheduled_test.dart'; 15 import '../../scheduled_test.dart';
16 import '../utils.dart'; 16 import '../utils.dart';
17 17
18 /// A descriptor describing a single file. 18 /// A descriptor describing a single file.
19 abstract class FileDescriptor extends Descriptor implements ReadableDescriptor { 19 abstract class FileDescriptor extends Descriptor implements ReadableDescriptor {
20 /// The contents of the file, in bytes. 20 /// The contents of the file, in bytes.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 Future _validateNow(List<int> actualContents) { 84 Future _validateNow(List<int> actualContents) {
85 if (orderedIterableEquals(contents, actualContents)) return null; 85 if (orderedIterableEquals(contents, actualContents)) return null;
86 // TODO(nweiz): show a hex dump here if the data is small enough. 86 // TODO(nweiz): show a hex dump here if the data is small enough.
87 throw "File '$name' didn't contain the expected binary data."; 87 throw "File '$name' didn't contain the expected binary data.";
88 } 88 }
89 } 89 }
90 90
91 class _StringFileDescriptor extends FileDescriptor { 91 class _StringFileDescriptor extends FileDescriptor {
92 _StringFileDescriptor(String name, String contents) 92 _StringFileDescriptor(String name, String contents)
93 : super._(name, encodeUtf8(contents)); 93 : super._(name, UTF8.encode(contents));
94 94
95 Future _validateNow(List<int> actualContents) { 95 Future _validateNow(List<int> actualContents) {
96 if (orderedIterableEquals(contents, actualContents)) return null; 96 if (orderedIterableEquals(contents, actualContents)) return null;
97 throw _textMismatchMessage(textContents, 97 throw _textMismatchMessage(textContents,
98 new String.fromCharCodes(actualContents)); 98 new String.fromCharCodes(actualContents));
99 } 99 }
100 100
101 String _textMismatchMessage(String expected, String actual) { 101 String _textMismatchMessage(String expected, String actual) {
102 final expectedLines = expected.split('\n'); 102 final expectedLines = expected.split('\n');
103 final actualLines = actual.split('\n'); 103 final actualLines = actual.split('\n');
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 _MatcherFileDescriptor(String name, this._matcher, {bool isBinary}) 141 _MatcherFileDescriptor(String name, this._matcher, {bool isBinary})
142 : _isBinary = isBinary == true ? true : false, 142 : _isBinary = isBinary == true ? true : false,
143 super._(name, <int>[]); 143 super._(name, <int>[]);
144 144
145 void _validateNow(List<int> actualContents) => 145 void _validateNow(List<int> actualContents) =>
146 expect( 146 expect(
147 _isBinary ? actualContents : new String.fromCharCodes(actualContents), 147 _isBinary ? actualContents : new String.fromCharCodes(actualContents),
148 _matcher); 148 _matcher);
149 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698