Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/c-api/tests/error.cc
1692 views
1
#include <gtest/gtest.h>
2
#include <wasmtime/error.hh>
3
4
using namespace wasmtime;
5
6
TEST(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
17
TEST(Error, Simple) {
18
Error err("hello");
19
EXPECT_EQ(err.message(), "hello");
20
EXPECT_FALSE(err.i32_exit());
21
}
22
23