Skip to content

Commit

Permalink
Merge pull request #2297 from hzeller/feature-20241201-ubsan-skip
Browse files Browse the repository at this point in the history
Skip a test that will fail with ubsan in case that sanitizer is enabled.
  • Loading branch information
hzeller authored Dec 2, 2024
2 parents f3da2ce + fe1da2b commit 936dfb1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions verible/verilog/formatting/verilog-token_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ namespace {

using FTT = FormatTokenType;

// UBSAN check will notice, that 9999 is out of range; skip test in that case
#ifndef UNDEFINED_BEHAVIOR_SANITIZER
// Test that GetFormatTokenType() correctly converts a TokenInfo enum to FTT
TEST(VerilogTokenTest, GetFormatTokenTypeTestUnknown) {
const int FAKE_TOKEN = 9999;
verible::TokenInfo token_info(FAKE_TOKEN, "FakeToken");
verible::PreFormatToken format_token(&token_info);
EXPECT_EQ(FTT::unknown, GetFormatTokenType(verilog_tokentype(FAKE_TOKEN)));
}
#endif

struct GetFormatTokenTypeTestCase {
verilog_tokentype token_info_type;
Expand Down

0 comments on commit 936dfb1

Please sign in to comment.