1 #include <gtest/gtest.h> 2 #include <wasmtime/error.hh> 3 4 using namespace wasmtime; 5 TEST(Result,Simple)6TEST(Result, Simple) { 7 Result<int> ok_result(1); 8 EXPECT_TRUE(ok_result); 9 EXPECT_EQ(ok_result.ok(), 1); 10 EXPECT_EQ(ok_result.unwrap(), 1); 11 12 Result<int, std::string> err_result("x"); 13 EXPECT_FALSE(err_result); 14 EXPECT_EQ(err_result.err(), "x"); 15 } 16 TEST(Error,Simple)17TEST(Error, Simple) { 18 Error err("hello"); 19 EXPECT_EQ(err.message(), "hello"); 20 EXPECT_FALSE(err.i32_exit()); 21 } 22