| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.test.file_system.physical_resource_provider_test; | 5 library analyzer.test.file_system.physical_resource_provider_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 expect(file.toString(), path); | 188 expect(file.toString(), path); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void test_toUri() { | 191 void test_toUri() { |
| 192 String path = '/foo/file.txt'; | 192 String path = '/foo/file.txt'; |
| 193 File file = PhysicalResourceProvider.INSTANCE.getFile(path); | 193 File file = PhysicalResourceProvider.INSTANCE.getFile(path); |
| 194 expect(file.toUri(), new Uri.file(path)); | 194 expect(file.toUri(), new Uri.file(path)); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void test_writeAsBytesSync() { | 197 void test_writeAsBytesSync() { |
| 198 new io.File(path).writeAsBytesSync(<int>[1, 2]); | 198 List<int> content = <int>[1, 2]; |
| 199 expect(file.readAsBytesSync(), <int>[1, 2]); | 199 new io.File(path).writeAsBytesSync(content); |
| 200 expect(file.readAsBytesSync(), content); |
| 200 // write new bytes | 201 // write new bytes |
| 201 file.writeAsBytesSync(<int>[10, 20]); | 202 content = <int>[10, 20]; |
| 202 expect(file.readAsBytesSync(), <int>[10, 20]); | 203 file.writeAsBytesSync(content); |
| 204 expect(file.readAsBytesSync(), content); |
| 205 } |
| 206 |
| 207 void test_writeAsStringSync() { |
| 208 String content = 'ab'; |
| 209 new io.File(path).writeAsStringSync(content); |
| 210 expect(file.readAsStringSync(), content); |
| 211 // write new bytes |
| 212 content = 'CD'; |
| 213 file.writeAsStringSync(content); |
| 214 expect(file.readAsStringSync(), content); |
| 203 } | 215 } |
| 204 } | 216 } |
| 205 | 217 |
| 206 @reflectiveTest | 218 @reflectiveTest |
| 207 class FolderTest extends _BaseTest { | 219 class FolderTest extends _BaseTest { |
| 208 String path; | 220 String path; |
| 209 Folder folder; | 221 Folder folder; |
| 210 | 222 |
| 211 setUp() { | 223 setUp() { |
| 212 super.setUp(); | 224 super.setUp(); |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 | 584 |
| 573 setUp() { | 585 setUp() { |
| 574 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); | 586 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); |
| 575 tempPath = tempDirectory.absolute.path; | 587 tempPath = tempDirectory.absolute.path; |
| 576 } | 588 } |
| 577 | 589 |
| 578 tearDown() { | 590 tearDown() { |
| 579 tempDirectory.deleteSync(recursive: true); | 591 tempDirectory.deleteSync(recursive: true); |
| 580 } | 592 } |
| 581 } | 593 } |
| OLD | NEW |