Skip to content

Commit 05bd56d

Browse files
committed
matp: Remove accidental switch fallthrough (#9082)
1 parent 11d3d82 commit 05bd56d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

libs/filament-matp/src/MaterialLexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ bool MaterialLexer::readLexeme() noexcept {
8585
case MaterialType::BLOCK:
8686
if (!readBlock()) {
8787
nextMaterialType = MaterialType::UNKNOWN;
88-
break;
8988
}
89+
break;
9090
case MaterialType::IDENTIFIER: readIdentifier(); break;
9191
case MaterialType::UNKNOWN: readUnknown(); break;
9292
default:

libs/filament-matp/tests/test_matp.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ TEST_F(MaterialLexer, MaterialParser) {
9595
EXPECT_EQ(result, true);
9696
}
9797

98+
TEST_F(MaterialLexer, NoSpaceBetweenBlockAndIdentifier) {
99+
matp::MaterialLexer materialLexer;
100+
static std::string source(R"(
101+
material {}fragment {}
102+
)");
103+
materialLexer.lex(source.c_str(), source.size(), 1);
104+
auto lexemes = materialLexer.getLexemes();
105+
EXPECT_EQ(lexemes.size(), 4);
106+
}
107+
98108
TEST_F(MaterialLexer, MaterialParserWithToolSection) {
99109
matp::MaterialParser parser;
100110
TestMaterialParser testParser(parser);
@@ -285,4 +295,4 @@ TEST_F(MaterialLexer, JsonMaterialParser) {
285295
int main(int argc, char** argv) {
286296
::testing::InitGoogleTest(&argc, argv);
287297
return RUN_ALL_TESTS();
288-
}
298+
}

0 commit comments

Comments
 (0)