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

Side by Side Diff: pkg/analyzer/test/file_system/physical_resource_provider_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
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.physical_file_system; 5 library test.physical_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 File file = PhysicalResourceProvider.INSTANCE.getResource(path); 95 File file = PhysicalResourceProvider.INSTANCE.getResource(path);
96 expect(file.modificationStamp, isNonNegative); 96 expect(file.modificationStamp, isNonNegative);
97 } 97 }
98 98
99 void test_parent() { 99 void test_parent() {
100 Resource parent = file.parent; 100 Resource parent = file.parent;
101 expect(parent, new isInstanceOf<Folder>()); 101 expect(parent, new isInstanceOf<Folder>());
102 expect(parent.path, equals(tempPath)); 102 expect(parent.path, equals(tempPath));
103 } 103 }
104 104
105 void test_readAsStringSync_doesNotExist() {
106 File file = PhysicalResourceProvider.INSTANCE.getResource(path);
107 expect(() {
108 file.readAsStringSync();
109 }, throwsA(_isFileSystemException));
110 }
111
112 void test_readAsStringSync_exists() {
113 new io.File(path).writeAsStringSync('abc');
114 File file = PhysicalResourceProvider.INSTANCE.getResource(path);
115 expect(file.readAsStringSync(), 'abc');
116 }
117
105 void test_shortName() { 118 void test_shortName() {
106 expect(file.shortName, 'file.txt'); 119 expect(file.shortName, 'file.txt');
107 } 120 }
108 121
109 void test_toString() { 122 void test_toString() {
110 expect(file.toString(), path); 123 expect(file.toString(), path);
111 } 124 }
112 } 125 }
113 126
114 @reflectiveTest 127 @reflectiveTest
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 386
374 setUp() { 387 setUp() {
375 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource'); 388 tempDirectory = io.Directory.systemTemp.createTempSync('test_resource');
376 tempPath = tempDirectory.absolute.path; 389 tempPath = tempDirectory.absolute.path;
377 } 390 }
378 391
379 tearDown() { 392 tearDown() {
380 tempDirectory.deleteSync(recursive: true); 393 tempDirectory.deleteSync(recursive: true);
381 } 394 }
382 } 395 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698