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

Side by Side Diff: pkg/analyzer/test/file_system/memory_file_system_test.dart

Issue 1007233002: Add readAsStringSync() to File. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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) 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 test.memory_file_system; 5 library test.memory_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/file_system/file_system.dart'; 9 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:analyzer/file_system/memory_file_system.dart'; 10 import 'package:analyzer/file_system/memory_file_system.dart';
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 void test_parent() { 116 void test_parent() {
117 provider.newFile('/foo/bar/file.txt', 'content'); 117 provider.newFile('/foo/bar/file.txt', 'content');
118 File file = provider.getResource('/foo/bar/file.txt'); 118 File file = provider.getResource('/foo/bar/file.txt');
119 Resource parent = file.parent; 119 Resource parent = file.parent;
120 expect(parent, new isInstanceOf<Folder>()); 120 expect(parent, new isInstanceOf<Folder>());
121 expect(parent.path, equals('/foo/bar')); 121 expect(parent.path, equals('/foo/bar'));
122 } 122 }
123 123
124 void test_readAsStringSync_doesNotExist() {
125 File file = provider.getResource('/test.txt');
126 expect(() {
127 file.readAsStringSync();
128 }, throwsA(_isFileSystemException));
129 }
130
131 void test_readAsStringSync_exists() {
132 File file = provider.newFile('/file.txt', 'abc');
133 expect(file.readAsStringSync(), 'abc');
134 }
135
124 void test_shortName() { 136 void test_shortName() {
125 File file = provider.getResource('/foo/bar/file.txt'); 137 File file = provider.getResource('/foo/bar/file.txt');
126 expect(file.shortName, 'file.txt'); 138 expect(file.shortName, 'file.txt');
127 } 139 }
128 140
129 void test_toString() { 141 void test_toString() {
130 File file = provider.getResource('/foo/bar/file.txt'); 142 File file = provider.getResource('/foo/bar/file.txt');
131 expect(file.toString(), '/foo/bar/file.txt'); 143 expect(file.toString(), '/foo/bar/file.txt');
132 } 144 }
133 } 145 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 return new Future.delayed(Duration.ZERO, computation); 552 return new Future.delayed(Duration.ZERO, computation);
541 } 553 }
542 554
543 _watchingFolder(String path, test(List<WatchEvent> changesReceived)) { 555 _watchingFolder(String path, test(List<WatchEvent> changesReceived)) {
544 Folder folder = provider.getResource(path); 556 Folder folder = provider.getResource(path);
545 var changesReceived = <WatchEvent>[]; 557 var changesReceived = <WatchEvent>[];
546 folder.changes.listen(changesReceived.add); 558 folder.changes.listen(changesReceived.add);
547 return test(changesReceived); 559 return test(changesReceived);
548 } 560 }
549 } 561 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698