Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ci/check_all_exposed_funs_tested.roc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ err_s = |err_msg| Err(StrErr(err_msg))
main! : List Arg => Result {} _
main! = |_args|
# Check if ripgrep is installed
_ = Cmd.exec!("rg", ["--version"]) ? |err| RipgrepNotInstalled(err)
_ = Cmd.exec!("rg", ["--version"]) ? RipgrepNotInstalled

cwd = Env.cwd!({}) ? |err| FailedToGetCwd(err)
cwd = Env.cwd!({}) ? FailedToGetCwd
Stdout.line!("Current working directory: ${Path.display(cwd)}")?

path_to_platform_main = "platform/main.roc"
Expand Down Expand Up @@ -87,7 +87,7 @@ is_function_unused! = |module_name, function_name|
search_dirs = ["examples", "tests"]

# Check current working directory
cwd = Env.cwd!({}) ? |err| FailedToGetCwd2(err)
cwd = Env.cwd!({}) ? FailedToGetCwd2

# Check if directories exist
List.for_each_try!(
Expand Down
2 changes: 1 addition & 1 deletion ci/check_cargo_versions_match.roc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ err_exit = |err_msg| Err(Exit(1, "\n❌ ${err_msg}"))

main! : List Arg => Result {} _
main! = |_args|
cwd = Env.cwd!({}) ? |err| FailedToGetCwd(err)
cwd = Env.cwd!({}) ? FailedToGetCwd
Stdout.line!("Current working directory: ${Path.display(cwd)}")?

root_cargo_path = "Cargo.toml"
Expand Down
6 changes: 3 additions & 3 deletions tests/file.roc
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ test_file_exists! = |{}|
filename = "test_exists.txt"
File.write_utf8!("", filename)?

test_file_exists = File.exists!(filename) ? |err| FileExistsCheckFailed(err)
test_file_exists = File.exists!(filename) ? FileExistsCheckFailed

if test_file_exists then
Stdout.line!("✓ File.exists! returns true for a file that exists")?
Expand All @@ -231,7 +231,7 @@ test_file_exists! = |{}|
# Test that a file that does not exist returns false
File.delete!(filename)?

test_file_exists_after_delete = File.exists!(filename) ? |err| FileExistsCheckAfterDeleteFailed(err)
test_file_exists_after_delete = File.exists!(filename) ? FileExistsCheckAfterDeleteFailed

if test_file_exists_after_delete then
Stderr.line!("✗ File.exists! returned true for a file that does not exist")?
Expand Down Expand Up @@ -261,7 +261,7 @@ cleanup_test_files! = |files_requirement|

when files_requirement is
FilesNeedToExist ->
delete_result ? |err| FileDeletionFailed(err)
delete_result ? FileDeletionFailed

FilesMaybeExist ->
Ok({})?
Expand Down
14 changes: 7 additions & 7 deletions tests/path-test.roc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ test_file_operations! = |{}|
# Verify file exists before deletion
_ = Cmd.exec!("test", ["-e", "test_to_delete.txt"])?

Path.delete!(delete_path) ? |err| DeleteFailed(err)
Path.delete!(delete_path) ? DeleteFailed

# Verify file is gone after deletion
exists_after_res = Cmd.exec!("test", ["-e", "test_to_delete.txt"])
Expand Down Expand Up @@ -331,7 +331,7 @@ test_path_rename! = |{}|
new_path = Path.from_str("test_path_rename_new.txt")
test_file_content = "Content for rename test."

Path.write_utf8!(test_file_content, original_path) ? |err| WriteOriginalFailed(err)
Path.write_utf8!(test_file_content, original_path) ? WriteOriginalFailed

# Rename the file
when Path.rename!(original_path, new_path) is
Expand All @@ -346,12 +346,12 @@ test_path_rename! = |{}|
else
Stdout.line!("✓ Original file no longer exists")?

new_file_exists = Path.is_file!(new_path) ? |err| NewIsFileFailed(err)
new_file_exists = Path.is_file!(new_path) ? NewIsFileFailed

if new_file_exists then
Stdout.line!("✓ Renamed file exists")?

content = Path.read_utf8!(new_path) ? |err| NewFileReadFailed(err)
content = Path.read_utf8!(new_path) ? NewFileReadFailed

if content == test_file_content then
Stdout.line!("✓ Renamed file has correct content")
Expand All @@ -371,7 +371,7 @@ test_path_exists! = |{}|
filename = Path.from_str("test_path_exists.txt")
Path.write_utf8!("This file exists", filename)?

file_exists = Path.exists!(filename) ? |err| PathExistsCheckFailed(err)
file_exists = Path.exists!(filename) ? PathExistsCheckFailed

if file_exists then
Stdout.line!("✓ Path.exists! returns true for a file that exists")?
Expand All @@ -381,7 +381,7 @@ test_path_exists! = |{}|
# Test that a file that does not exist returns false
Path.delete!(filename)?

file_exists_after_delete = Path.exists!(filename) ? |err| PathExistsCheckAfterDeleteFailed(err)
file_exists_after_delete = Path.exists!(filename) ? PathExistsCheckAfterDeleteFailed

if file_exists_after_delete then
Stderr.line!("✗ Path.exists! returned true for a file that does not exist")?
Expand Down Expand Up @@ -419,7 +419,7 @@ cleanup_test_files! = |files_requirement|

when files_requirement is
FilesNeedToExist ->
delete_result ? |err| FileDeletionFailed(err)
delete_result ? FileDeletionFailed
FilesMaybeExist ->
Ok({})?

Expand Down
12 changes: 6 additions & 6 deletions tests/tcp.roc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ test_tcp_functions! = |stream|
do_not_read_bytes = [100, 111, 32, 110, 111, 116, 32, 114, 101, 97, 100, 32, 112, 97, 115, 116, 32, 109, 101, 65] # "do not read past meA" in bytes
Tcp.write!(stream, do_not_read_bytes)?

nineteen_bytes = Tcp.read_up_to!(stream, 19) ? |err| FailedReadUpTo(err)
nineteen_bytes_as_str = Str.from_utf8(nineteen_bytes) ? |err| ReadUpToFromUtf8(err)
nineteen_bytes = Tcp.read_up_to!(stream, 19) ? FailedReadUpTo
nineteen_bytes_as_str = Str.from_utf8(nineteen_bytes) ? ReadUpToFromUtf8

Stdout.line!(
"""
Expand All @@ -72,8 +72,8 @@ test_tcp_functions! = |stream|
)?
Tcp.write_utf8!(stream, "BC")?

three_bytes = Tcp.read_exactly!(stream, 3) ? |err| FailedReadExactly(err)
three_bytes_as_str = Str.from_utf8(three_bytes) ? |err| ReadExactlyFromUtf8(err)
three_bytes = Tcp.read_exactly!(stream, 3) ? FailedReadExactly
three_bytes_as_str = Str.from_utf8(three_bytes) ? ReadExactlyFromUtf8

Stdout.line!(
"""
Expand All @@ -85,8 +85,8 @@ test_tcp_functions! = |stream|
)?
Tcp.write_utf8!(stream, "Line1\nLine2\n")?

bytes_until = Tcp.read_until!(stream, '\n') ? |err| FailedReadUntil(err)
bytes_until_as_str = Str.from_utf8(bytes_until) ? |err| ReadUntilFromUtf8(err)
bytes_until = Tcp.read_until!(stream, '\n') ? FailedReadUntil
bytes_until_as_str = Str.from_utf8(bytes_until) ? ReadUntilFromUtf8

Stdout.line!("Tcp.read_until yielded: '${bytes_until_as_str}'")?

Expand Down