mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
- 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.
20 lines
365 B
Plaintext
20 lines
365 B
Plaintext
import "io" for File
|
|
import "scheduler" for Scheduler
|
|
|
|
// See also: is_open.wren.
|
|
|
|
var file = File.open("test/io/file/close.wren")
|
|
|
|
System.print(file.close()) // expect: null
|
|
|
|
// Can call multiple times.
|
|
file.close()
|
|
|
|
// If already closed, returns synchronously.
|
|
Scheduler.add {
|
|
System.print("does not print")
|
|
}
|
|
|
|
file.close()
|
|
System.print("sync") // expect: sync
|