Fix wiggle tests
This commit is contained in:
committed by
Andrew Brown
parent
df9c725fa0
commit
fa98f0bc91
@@ -17,11 +17,11 @@ mod convert_just_errno {
|
||||
// trivial function.
|
||||
wiggle::from_witx!({
|
||||
witx_literal: "
|
||||
(typename $errno (enum u8 $ok $invalid_arg $picket_line))
|
||||
(typename $errno (enum (@witx tag u8) $ok $invalid_arg $picket_line))
|
||||
(module $one_error_conversion
|
||||
(@interface func (export \"foo\")
|
||||
(param $strike u32)
|
||||
(result $err $errno)))
|
||||
(result $err (expected (error $errno)))))
|
||||
",
|
||||
ctx: WasiCtx,
|
||||
errors: { errno => RichError },
|
||||
@@ -68,7 +68,7 @@ mod convert_just_errno {
|
||||
let r0 = one_error_conversion::foo(&ctx, &host_memory, 0);
|
||||
assert_eq!(
|
||||
r0,
|
||||
Ok(i32::from(types::Errno::Ok)),
|
||||
Ok(types::Errno::Ok as i32),
|
||||
"Expected return value for strike=0"
|
||||
);
|
||||
assert!(ctx.log.borrow().is_empty(), "No error log for strike=0");
|
||||
@@ -77,7 +77,7 @@ mod convert_just_errno {
|
||||
let r1 = one_error_conversion::foo(&ctx, &host_memory, 1);
|
||||
assert_eq!(
|
||||
r1,
|
||||
Ok(i32::from(types::Errno::PicketLine)),
|
||||
Ok(types::Errno::PicketLine as i32),
|
||||
"Expected return value for strike=1"
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -90,7 +90,7 @@ mod convert_just_errno {
|
||||
let r2 = one_error_conversion::foo(&ctx, &host_memory, 2);
|
||||
assert_eq!(
|
||||
r2,
|
||||
Ok(i32::from(types::Errno::InvalidArg)),
|
||||
Ok(types::Errno::InvalidArg as i32),
|
||||
"Expected return value for strike=2"
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -120,15 +120,15 @@ mod convert_multiple_error_types {
|
||||
// Additionally, test that the function "baz" marked noreturn always returns a wiggle::Trap.
|
||||
wiggle::from_witx!({
|
||||
witx_literal: "
|
||||
(typename $errno (enum u8 $ok $invalid_arg $picket_line))
|
||||
(typename $errno2 (enum u8 $ok $too_much_coffee))
|
||||
(typename $errno (enum (@witx tag u8) $ok $invalid_arg $picket_line))
|
||||
(typename $errno2 (enum (@witx tag u8) $ok $too_much_coffee))
|
||||
(module $two_error_conversions
|
||||
(@interface func (export \"foo\")
|
||||
(param $strike u32)
|
||||
(result $err $errno))
|
||||
(result $err (expected (error $errno))))
|
||||
(@interface func (export \"bar\")
|
||||
(param $drink u32)
|
||||
(result $err $errno2))
|
||||
(result $err (expected (error $errno2))))
|
||||
(@interface func (export \"baz\")
|
||||
(param $drink u32)
|
||||
(@witx noreturn)))
|
||||
|
||||
Reference in New Issue
Block a user