mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 14:18:42 +01:00
Merge branch 'master' into api
# Conflicts: # src/module/io.c
This commit is contained in:
1
test/io/directory/dir/a.txt
Normal file
1
test/io/directory/dir/a.txt
Normal file
@ -0,0 +1 @@
|
||||
this is a text file
|
||||
1
test/io/directory/dir/b.txt
Normal file
1
test/io/directory/dir/b.txt
Normal file
@ -0,0 +1 @@
|
||||
this is a text file
|
||||
1
test/io/directory/dir/c.txt
Normal file
1
test/io/directory/dir/c.txt
Normal file
@ -0,0 +1 @@
|
||||
this is a text file
|
||||
8
test/io/directory/list.wren
Normal file
8
test/io/directory/list.wren
Normal file
@ -0,0 +1,8 @@
|
||||
import "io" for Directory
|
||||
|
||||
var entries = Directory.list("test/io/directory/dir")
|
||||
|
||||
// Ignore OS-specific dot files like ".DS_Store".
|
||||
entries = entries.where {|entry| !entry.startsWith(".") }.toList
|
||||
|
||||
System.print(entries) // expect: [a.txt, b.txt, c.txt]
|
||||
3
test/io/directory/list_file.wren
Normal file
3
test/io/directory/list_file.wren
Normal file
@ -0,0 +1,3 @@
|
||||
import "io" for Directory
|
||||
|
||||
var entries = Directory.list("test/io/directory/dir/a.txt") // expect runtime error: not a directory
|
||||
3
test/io/directory/list_nonexistent.wren
Normal file
3
test/io/directory/list_nonexistent.wren
Normal file
@ -0,0 +1,3 @@
|
||||
import "io" for Directory
|
||||
|
||||
Directory.list("nonexistent") // expect runtime error: no such file or directory
|
||||
3
test/io/directory/list_wrong_arg_type.wren
Normal file
3
test/io/directory/list_wrong_arg_type.wren
Normal file
@ -0,0 +1,3 @@
|
||||
import "io" for Directory
|
||||
|
||||
Directory.list(123) // expect runtime error: Path must be a string.
|
||||
Reference in New Issue
Block a user