MCPcopy Create free account
hub / github.com/ThePhD/sol2 / lua_value_construct_race

Function lua_value_construct_race

tests/run_time/source/lua_value.cpp:51–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49std::mutex lua_value_construct_require_mutex;
50
51void lua_value_construct_race() {
52 sol::state lua;
53 try {
54 lua.open_libraries();
55 lua["a"] = sol::lua_value(lua, 24);
56 int a = lua["a"];
57 {
58 std::lock_guard<std::mutex> lg(lua_value_construct_require_mutex);
59 REQUIRE(a == 24);
60 }
61 }
62 catch (const sol::error& e) {
63 std::lock_guard<std::mutex> lg(lua_value_construct_require_mutex);
64 INFO(e.what());
65 REQUIRE(false);
66 }
67 catch (...) {
68 std::lock_guard<std::mutex> lg(lua_value_construct_require_mutex);
69 REQUIRE(false);
70 }
71}
72
73TEST_CASE("lua_value/nested", "make nested values can be put in lua_value properly") {
74#if SOL_IS_ON(SOL_STD_VARIANT)

Callers

nothing calls this directly

Calls 3

open_librariesMethod · 0.80
whatMethod · 0.80
lua_valueClass · 0.50

Tested by

no test coverage detected