convert all errno assertions to assert_errno!

This commit is contained in:
Pat Hickey
2021-01-27 18:10:38 -08:00
parent 4f655001c0
commit 2ae1dee642
25 changed files with 147 additions and 233 deletions

View File

@@ -1,5 +1,5 @@
use std::{env, process};
use wasi_tests::{create_file, open_scratch_directory};
use wasi_tests::{assert_errno, create_file, open_scratch_directory};
unsafe fn test_readlink(dir_fd: wasi::Fd) {
// Create a file in the scratch directory.
@@ -25,11 +25,7 @@ unsafe fn test_readlink(dir_fd: wasi::Fd) {
let err = wasi::path_readlink(dir_fd, "symlink", buf.as_mut_ptr(), buf.len())
.err()
.expect("readlink with too-small buffer should fail");
assert_eq!(
err.raw_error(),
wasi::ERRNO_RANGE,
"readlink with too-small buffer should give ERANGE"
);
assert_errno!(err.raw_error(), wasi::ERRNO_RANGE);
// Clean up.
wasi::path_unlink_file(dir_fd, "target").expect("removing a file");