Skip to content

Commit 20a349f

Browse files
committed
Add test for out of range arg
1 parent 7fb59fe commit 20a349f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎tests/test_error_code_message.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,16 @@ TEST(ErrorCodeMessageTest, toString_uses_cpp_override_for_code_100_unknown_arg)
195195
EXPECT_NE(result.find("Unknown robot mode: 127"), std::string::npos);
196196
}
197197

198+
TEST(ErrorCodeMessageTest, to_sting_uses_cpp_override_for_code_100_out_of_range_arg)
199+
{
200+
// The C++ override (step 1) takes priority over the static map.
201+
// Code 100, arg 99999 (out of range) must come from the override, not the fallback.
202+
auto msg = makeMsg(100, 99999);
203+
const std::string result = msg->toString();
204+
EXPECT_NE(result, fallback(100, 99999));
205+
EXPECT_NE(result.find("arg 99999 out of range for RobotMode"), std::string::npos);
206+
}
207+
198208
TEST(ErrorCodeMessageTest, toString_uses_static_map_exact_match)
199209
{
200210
// Code 4, arg 1 is in the generated map; override returns nullopt.

0 commit comments

Comments
 (0)