Reading files!

- File.close()
- File.open()
- File.read()
- file.readBytes()

And a few other little methods. Still lots more work to do, but it's a
start.
This commit is contained in:
Bob Nystrom
2015-09-30 21:13:36 -07:00
parent bacbd85543
commit b7ed774da3
32 changed files with 475 additions and 44 deletions
+16
View File
@@ -0,0 +1,16 @@
import "io" for File
var stash
File.open("test/io/file/open_block.wren") {|file|
System.print(file is File) // expect: true
System.print(file.isOpen) // expect: true
stash = file
}
// Closes after block.
System.print(stash.isOpen) // expect: false
// Returns null.
System.print(File.open("test/io/file/open_block.wren") {|file|}) // expect: null
// TODO: Test a fiber aborting inside the block.