diff --git a/tests/test_SymbolTable.cpp b/tests/test_SymbolTable.cpp index c97706921882c4473b40d0a3a47f897a3d977b9d..aa15ef0c1f2e082585c15fed7aad8b2676d0c5e8 100644 --- a/tests/test_SymbolTable.cpp +++ b/tests/test_SymbolTable.cpp @@ -13,14 +13,19 @@ TEST_CASE("SymbolTable", "[language]") using namespace TAO_PEGTL_NAMESPACE; position begin_position{internal::iterator{"fixture"}, "fixture"}; + begin_position.byte = 2; auto [i_symbol_a, created_a] = root_st->add("a", begin_position); REQUIRE(created_a); + REQUIRE(i_symbol_a->second.position().byte == 2); + // Check that one cannot build another "a" in this table REQUIRE(not root_st->add("a", begin_position).second); position use_position{internal::iterator{"fixture"}, "fixture"}; + use_position.byte = 3; // after declarative position + auto [i_search_a, found_a] = root_st->find("a", use_position); REQUIRE(found_a); REQUIRE(i_search_a == i_symbol_a); @@ -65,6 +70,9 @@ TEST_CASE("SymbolTable", "[language]") REQUIRE(std::holds_alternative<double>(attributes_a.value())); + const auto const_attribute_a = attributes_a; + REQUIRE(std::get<double>(const_attribute_a.value()) == 2.3); + { std::stringstream value_output; value_output << attributes_a;