A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Fix nodiscard warnings in C++ tests (#13148)
Alex Crichton0b2a3af3aee5
diff --git a/crates/c-api/tests/func.cc b/crates/c-api/tests/func.ccindex 8d7bd4ba95..93119003c7 100644--- a/crates/c-api/tests/func.cc+++ b/crates/c-api/tests/func.cc@@ -87,13 +87,13 @@ TEST(TypedFunc, Call) {FuncType ty({ValKind::ExternRef, ValKind::ExternRef},{ValKind::ExternRef, ValKind::ExternRef});Func f(store, ty, [](auto caller, auto params, auto results) {- caller.context().gc();+ caller.context().gc().unwrap();EXPECT_TRUE(params[0].externref());EXPECT_EQ(std::any_cast<int>(params[0].externref()->data(caller)), 100);EXPECT_FALSE(params[1].externref());results[0] = ExternRef(caller, int(3));results[1] = std::optional<ExternRef>(std::nullopt);- caller.context().gc();+ caller.context().gc().unwrap();return std::monostate();});@@ -102,7 +102,7 @@ TEST(TypedFunc, Call) {auto func = f.typed<ExternRefPair, ExternRefPair>(store).unwrap();auto result =func.call(store, {ExternRef(store, int(100)), std::nullopt}).unwrap();- store.context().gc();+ store.context().gc().unwrap();EXPECT_EQ(std::any_cast<int>(std::get<0>(result)->data(store)), 3);EXPECT_EQ(std::get<1>(result), std::nullopt);}diff --git a/crates/c-api/tests/store.cc b/crates/c-api/tests/store.ccindex 0978604968..f89dc6f124 100644--- a/crates/c-api/tests/store.cc+++ b/crates/c-api/tests/store.cc@@ -25,7 +25,7 @@ TEST(Store, Smoke) {store = Store(engine);store.limiter(-1, -1, -1, -1, -1);- store.context().gc();+ store.context().gc().unwrap();store.context().get_fuel().err();store.context().set_fuel(1).err();store.context().set_epoch_deadline(1);diff --git a/crates/c-api/tests/val.cc b/crates/c-api/tests/val.ccindex 7d18166ab4..50dbac9487 100644--- a/crates/c-api/tests/val.cc+++ b/crates/c-api/tests/val.cc@@ -110,11 +110,11 @@ TEST(Val, DropsExternRef) {flag = guard.flag();ExternRef r(store, std::make_shared<SetOnDrop>(std::move(guard)));EXPECT_FALSE(flag->load());- store.gc();+ store.gc().unwrap();EXPECT_FALSE(flag->load());}EXPECT_FALSE(flag->load());- store.gc();+ store.gc().unwrap();EXPECT_TRUE(flag->load());// Test that if a `Val(ExternRef)` is created and dropped it doesn't leak.@@ -124,11 +124,11 @@ TEST(Val, DropsExternRef) {ExternRef r(store, std::make_shared<SetOnDrop>(std::move(guard)));Val v(r);EXPECT_FALSE(flag->load());- store.gc();+ store.gc().unwrap();EXPECT_FALSE(flag->load());}EXPECT_FALSE(flag->load());- store.gc();+ store.gc().unwrap();EXPECT_TRUE(flag->load());// Similar to above testing a variety of APIs.@@ -147,10 +147,10 @@ TEST(Val, DropsExternRef) {v3 = v2;v = std::move(v2);- store.gc();+ store.gc().unwrap();EXPECT_FALSE(flag->load());}EXPECT_FALSE(flag->load());- store.gc();+ store.gc().unwrap();EXPECT_TRUE(flag->load());}