mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 11:56:54 +03:00
Merge pull request #668 from HigherOrderCO/462-reenable-io-tests
#462 Reenable io tests
This commit is contained in:
commit
d2cc03eae1
@ -323,10 +323,14 @@ def IO/FS/read_line.read_chunks(fd, chunks):
|
||||
# Writes a list of bytes to a file given by a path.
|
||||
def IO/FS/write_file(path, bytes):
|
||||
with IO:
|
||||
f <- IO/done_on_err(IO/FS/open(path, "w"))
|
||||
* <- IO/done_on_err(IO/FS/write(f, bytes))
|
||||
* <- IO/done_on_err(IO/FS/close(f))
|
||||
return wrap(bytes)
|
||||
f <- IO/FS/open(path, "w")
|
||||
match f:
|
||||
case Result/Err:
|
||||
return wrap(Result/Err(f.val))
|
||||
case Result/Ok:
|
||||
* <- IO/done_on_err(IO/FS/write(f.val, bytes))
|
||||
* <- IO/done_on_err(IO/FS/close(f.val))
|
||||
return wrap(Result/Ok(bytes))
|
||||
|
||||
### Standard input and output utilities
|
||||
|
||||
|
@ -427,7 +427,6 @@ fn mutual_recursion() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "while IO is not implemented for hvm32"]
|
||||
fn io() {
|
||||
run_golden_test_dir_multiple(
|
||||
function_name!(),
|
||||
|
6
tests/snapshots/io__load.bend.snap
Normal file
6
tests/snapshots/io__load.bend.snap
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/io/load.bend
|
||||
---
|
||||
Strict mode:
|
||||
"Contents\n"
|
6
tests/snapshots/io__load_fail.bend.snap
Normal file
6
tests/snapshots/io__load_fail.bend.snap
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/io/load_fail.bend
|
||||
---
|
||||
Strict mode:
|
||||
1
|
6
tests/snapshots/io__store.bend.snap
Normal file
6
tests/snapshots/io__store.bend.snap
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/io/store.bend
|
||||
---
|
||||
Strict mode:
|
||||
λa (a Result/Ok/tag [40, 77, 97, 105, 110, 41, 32, 61, 32, 48])
|
6
tests/snapshots/io__store_fail.bend.snap
Normal file
6
tests/snapshots/io__store_fail.bend.snap
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/io/store_fail.bend
|
||||
---
|
||||
Strict mode:
|
||||
λa (a Result/Err/tag λb (b 2 +2))
|
Loading…
Reference in New Issue
Block a user