| Index: utils/tests/pub/test_pub.dart
|
| diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
|
| index 66d9434f2a373f364d9ce21ef98ed9ac5d0eb62a..abec9d4229008529dbadc7ce7f2e5238fdd5f951 100644
|
| --- a/utils/tests/pub/test_pub.dart
|
| +++ b/utils/tests/pub/test_pub.dart
|
| @@ -14,6 +14,7 @@ import 'dart:io';
|
| import 'dart:json' as json;
|
| import 'dart:math';
|
| import 'dart:uri';
|
| +import 'dart:utf';
|
|
|
| import '../../../pkg/http/lib/testing.dart';
|
| import '../../../pkg/oauth2/lib/oauth2.dart' as oauth2;
|
| @@ -49,6 +50,10 @@ initConfig() {
|
| FileDescriptor file(Pattern name, String contents) =>
|
| new FileDescriptor(name, contents);
|
|
|
| +/// Creates a new [FileDescriptor] with [name] and [contents].
|
| +FileDescriptor binaryFile(Pattern name, List<int> contents) =>
|
| + new FileDescriptor.bytes(name, contents);
|
| +
|
| /// Creates a new [DirectoryDescriptor] with [name] and [contents].
|
| DirectoryDescriptor dir(Pattern name, [List<Descriptor> contents]) =>
|
| new DirectoryDescriptor(name, contents);
|
| @@ -866,16 +871,17 @@ abstract class Descriptor {
|
| /// tree before running a test, and for validating that the file system matches
|
| /// some expectations after running it.
|
| class FileDescriptor extends Descriptor {
|
| - /// The text contents of the file.
|
| - final String contents;
|
| + /// The contents of the file, in bytes.
|
| + final List<int> contents;
|
|
|
| - FileDescriptor(Pattern name, this.contents) : super(name);
|
| + FileDescriptor.bytes(Pattern name, this.contents) : super(name);
|
| +
|
| + FileDescriptor(Pattern name, String contents) :
|
| + this.bytes(name, encodeUtf8(contents));
|
|
|
| /// Creates the file within [dir]. Returns a [Future] that is completed after
|
| /// the creation is done.
|
| - Future<File> create(dir) {
|
| - return writeTextFile(join(dir, _stringName), contents);
|
| - }
|
| + Future<File> create(dir) => writeByteFile(join(dir, _stringName), contents);
|
|
|
| /// Deletes the file within [dir]. Returns a [Future] that is completed after
|
| /// the deletion is done.
|
|
|