| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:pathos/path.dart' as path; | 8 import 'package:pathos/path.dart' as path; |
| 9 import 'package:scheduled_test/descriptor.dart' as d; | 9 import 'package:scheduled_test/descriptor.dart' as d; |
| 10 import 'package:scheduled_test/scheduled_test.dart'; | 10 import 'package:scheduled_test/scheduled_test.dart'; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 }, passing: ['test 2']); | 107 }, passing: ['test 2']); |
| 108 | 108 |
| 109 expectTestsPass("file().read() returns the contents of the file as a stream", | 109 expectTestsPass("file().read() returns the contents of the file as a stream", |
| 110 () { | 110 () { |
| 111 test('test', () { | 111 test('test', () { |
| 112 expect(byteStreamToString(d.file('name.txt', 'contents').read()), | 112 expect(byteStreamToString(d.file('name.txt', 'contents').read()), |
| 113 completion(equals('contents'))); | 113 completion(equals('contents'))); |
| 114 }); | 114 }); |
| 115 }); | 115 }); |
| 116 | 116 |
| 117 expectTestsPass("file().load() throws an error", () { | |
| 118 test('test', () { | |
| 119 expect(d.file('name.txt', 'contents').load('path').toList(), | |
| 120 throwsA(equals("Can't load 'path' from within 'name.txt': not a " | |
| 121 "directory."))); | |
| 122 }); | |
| 123 }); | |
| 124 | |
| 125 expectTestsPass("file().describe() returns the filename", () { | 117 expectTestsPass("file().describe() returns the filename", () { |
| 126 test('test', () { | 118 test('test', () { |
| 127 expect(d.file('name.txt', 'contents').describe(), equals('name.txt')); | 119 expect(d.file('name.txt', 'contents').describe(), equals('name.txt')); |
| 128 }); | 120 }); |
| 129 }); | 121 }); |
| 130 | 122 |
| 131 expectTestsPass('binaryFile().create() creates a file', () { | 123 expectTestsPass('binaryFile().create() creates a file', () { |
| 132 test('test', () { | 124 test('test', () { |
| 133 scheduleSandbox(); | 125 scheduleSandbox(); |
| 134 | 126 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 260 |
| 269 test('test 2', () { | 261 test('test 2', () { |
| 270 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); | 262 expect(errors, everyElement(new isInstanceOf<ScheduleError>())); |
| 271 expect(errors.map((e) => e.error.message), equals([ | 263 expect(errors.map((e) => e.error.message), equals([ |
| 272 "Expected: contains <12>\n" | 264 "Expected: contains <12>\n" |
| 273 " But: was [98, 97, 114, 102, 111, 111, 98, 97, 122].\n" | 265 " But: was [98, 97, 114, 102, 111, 111, 98, 97, 122].\n" |
| 274 ]), verbose: true); | 266 ]), verbose: true); |
| 275 }); | 267 }); |
| 276 }, passing: ['test 2']); | 268 }, passing: ['test 2']); |
| 277 } | 269 } |
| OLD | NEW |