| OLD | NEW | 
|---|
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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:typed_data'; | 5 import 'dart:typed_data'; | 
| 6 | 6 | 
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; | 
| 8 import 'package:file/file.dart'; | 8 import 'package:file/file.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/__dartino_dart_io_non_exist_file__'; | 
| 20   Expect.throws(() => new File.open(path), isFileException); | 20   Expect.throws(() => new File.open(path), isFileException); | 
| 21   var file = new File.temporary("/tmp/file_test"); | 21   var file = new File.temporary("/tmp/file_test"); | 
| 22   Expect.isTrue(file.isOpen); | 22   Expect.isTrue(file.isOpen); | 
| 23   Expect.isTrue(File.existsAsFile(file.path)); | 23   Expect.isTrue(File.existsAsFile(file.path)); | 
| 24   file.close(); | 24   file.close(); | 
| 25   Expect.isFalse(file.isOpen); | 25   Expect.isFalse(file.isOpen); | 
| 26   File.delete(file.path); | 26   File.delete(file.path); | 
| 27   Expect.isFalse(File.existsAsFile(file.path)); | 27   Expect.isFalse(File.existsAsFile(file.path)); | 
| 28 } | 28 } | 
| 29 | 29 | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 59   Expect.equals(0, file.length); | 59   Expect.equals(0, file.length); | 
| 60   file.position = 0; | 60   file.position = 0; | 
| 61   Expect.equals(0, file.position); | 61   Expect.equals(0, file.position); | 
| 62   file.position = 1; | 62   file.position = 1; | 
| 63   Expect.equals(1, file.position); | 63   Expect.equals(1, file.position); | 
| 64   Expect.equals(0, file.length); | 64   Expect.equals(0, file.length); | 
| 65 | 65 | 
| 66   file.close(); | 66   file.close(); | 
| 67   File.delete(file.path); | 67   File.delete(file.path); | 
| 68 } | 68 } | 
| OLD | NEW | 
|---|