OLD | NEW |
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_test; | 5 library descriptor_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:pathos/path.dart' as path; | 10 import 'package:pathos/path.dart' as path; |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 expectTestsPass("directory().load() fails to load a nested directory", () { | 725 expectTestsPass("directory().load() fails to load a nested directory", () { |
726 test('test', () { | 726 test('test', () { |
727 var dir = d.dir('dir', [ | 727 var dir = d.dir('dir', [ |
728 d.dir('subdir', [ | 728 d.dir('subdir', [ |
729 d.file('name.txt', 'subcontents') | 729 d.file('name.txt', 'subcontents') |
730 ]), | 730 ]), |
731 d.file('name.txt', 'contents') | 731 d.file('name.txt', 'contents') |
732 ]); | 732 ]); |
733 | 733 |
734 expect(dir.load('subdir').toList(), | 734 expect(dir.load('subdir').toList(), |
735 throwsA(equals("Can't load the contents of 'subdir': is a " | 735 throwsA(equals("Can't read the contents of 'subdir': is a " |
736 "directory."))); | 736 "directory."))); |
737 }); | 737 }); |
738 }); | 738 }); |
739 | 739 |
740 expectTestsPass("directory().load() fails to load an absolute path", () { | 740 expectTestsPass("directory().load() fails to load an absolute path", () { |
741 test('test', () { | 741 test('test', () { |
742 var dir = d.dir('dir', [d.file('name.txt', 'contents')]); | 742 var dir = d.dir('dir', [d.file('name.txt', 'contents')]); |
743 | 743 |
744 expect(dir.load('/name.txt').toList(), | 744 expect(dir.load('/name.txt').toList(), |
745 throwsA(equals("Can't load absolute path '/name.txt'."))); | 745 throwsA(equals("Can't load absolute path '/name.txt'."))); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 | 882 |
883 Future<List<int>> byteStreamToList(Stream<List<int>> stream) { | 883 Future<List<int>> byteStreamToList(Stream<List<int>> stream) { |
884 return stream.reduce(<int>[], (buffer, chunk) { | 884 return stream.reduce(<int>[], (buffer, chunk) { |
885 buffer.addAll(chunk); | 885 buffer.addAll(chunk); |
886 return buffer; | 886 return buffer; |
887 }); | 887 }); |
888 } | 888 } |
889 | 889 |
890 Future<String> byteStreamToString(Stream<List<int>> stream) => | 890 Future<String> byteStreamToString(Stream<List<int>> stream) => |
891 byteStreamToList(stream).then((bytes) => new String.fromCharCodes(bytes)); | 891 byteStreamToList(stream).then((bytes) => new String.fromCharCodes(bytes)); |
OLD | NEW |