diff --git a/ci/check_all_exposed_funs_tested.roc b/ci/check_all_exposed_funs_tested.roc index f3cc9fe1..126dbb3a 100644 --- a/ci/check_all_exposed_funs_tested.roc +++ b/ci/check_all_exposed_funs_tested.roc @@ -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" @@ -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!( diff --git a/ci/check_cargo_versions_match.roc b/ci/check_cargo_versions_match.roc index 70adc2bf..b6f8790a 100644 --- a/ci/check_cargo_versions_match.roc +++ b/ci/check_cargo_versions_match.roc @@ -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" diff --git a/tests/file.roc b/tests/file.roc index 0c423da6..3a95d13d 100755 --- a/tests/file.roc +++ b/tests/file.roc @@ -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")? @@ -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")? @@ -261,7 +261,7 @@ cleanup_test_files! = |files_requirement| when files_requirement is FilesNeedToExist -> - delete_result ? |err| FileDeletionFailed(err) + delete_result ? FileDeletionFailed FilesMaybeExist -> Ok({})? diff --git a/tests/path-test.roc b/tests/path-test.roc index 3a2f87c3..7011607b 100755 --- a/tests/path-test.roc +++ b/tests/path-test.roc @@ -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"]) @@ -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 @@ -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") @@ -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")? @@ -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")? @@ -419,7 +419,7 @@ cleanup_test_files! = |files_requirement| when files_requirement is FilesNeedToExist -> - delete_result ? |err| FileDeletionFailed(err) + delete_result ? FileDeletionFailed FilesMaybeExist -> Ok({})? diff --git a/tests/tcp.roc b/tests/tcp.roc index b177a0ec..ca7051de 100644 --- a/tests/tcp.roc +++ b/tests/tcp.roc @@ -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!( """ @@ -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!( """ @@ -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}'")?