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

Side by Side Diff: tests/io/file_test.dart

Issue 1209033003: Work in progres, please take a look and give early feedback if this is the way we want to structure… (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: address comments Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Fletch 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'dart:io'; 5 import 'dart:io';
6 import 'dart:typed_data'; 6 import 'dart:typed_data';
7 7
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 void main() { 10 void main() {
11 testOpen(); 11 testOpen();
12 testReadWrite(); 12 testReadWrite();
13 testSeek(); 13 testSeek();
14 } 14 }
15 15
16 bool isFileException(e) => e is FileException; 16 bool isFileException(e) => e is FileException;
17 17
18 void testOpen() { 18 void testOpen() {
19 String path = '/tmp/__fletch_dart_io_non_exist_file__'; 19 String path = '/tmp/__fletch_dart_io_non_exist_file__';
20 Expect.throws(() => new File.open(path), isFileException); 20 Expect.throws(() => new File.open(path), isFileException);
21
22 var file = new File.temporary("/tmp/file_test"); 21 var file = new File.temporary("/tmp/file_test");
23 Expect.isTrue(file.isOpen); 22 Expect.isTrue(file.isOpen);
24 Expect.isTrue(File.existsAsFile(file.path)); 23 Expect.isTrue(File.existsAsFile(file.path));
25 file.close(); 24 file.close();
26 Expect.isFalse(file.isOpen); 25 Expect.isFalse(file.isOpen);
27 File.delete(file.path); 26 File.delete(file.path);
28 Expect.isFalse(File.existsAsFile(file.path)); 27 Expect.isFalse(File.existsAsFile(file.path));
29 } 28 }
30 29
31 void testReadWrite() { 30 void testReadWrite() {
(...skipping 28 matching lines...) Expand all
60 Expect.equals(0, file.length); 59 Expect.equals(0, file.length);
61 file.position = 0; 60 file.position = 0;
62 Expect.equals(0, file.position); 61 Expect.equals(0, file.position);
63 file.position = 1; 62 file.position = 1;
64 Expect.equals(1, file.position); 63 Expect.equals(1, file.position);
65 Expect.equals(0, file.length); 64 Expect.equals(0, file.length);
66 65
67 file.close(); 66 file.close();
68 File.delete(file.path); 67 File.delete(file.path);
69 } 68 }
OLDNEW
« no previous file with comments | « tests/ffi/ffi_timeofday_test.dart ('k') | tests/service_tests/conformance/dart/conformance_service.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698