Skip to content

Commit 6630aa5

Browse files
authored
matp: Remove accidental switch fallthrough (#9082)
1 parent bc83ffd commit 6630aa5

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
@@ -97,6 +97,16 @@ TEST_F(MaterialLexer, MaterialParser) {
9797
EXPECT_EQ(result, true);
9898
}
9999

100+
TEST_F(MaterialLexer, NoSpaceBetweenBlockAndIdentifier) {
101+
matp::MaterialLexer materialLexer;
102+
static std::string source(R"(
103+
material {}fragment {}
104+
)");
105+
materialLexer.lex(source.c_str(), source.size(), 1);
106+
auto lexemes = materialLexer.getLexemes();
107+
EXPECT_EQ(lexemes.size(), 4);
108+
}
109+
100110
TEST_F(MaterialLexer, MaterialParserWithToolSection) {
101111
matp::MaterialParser parser;
102112
TestMaterialParser testParser(parser);
@@ -287,4 +297,4 @@ TEST_F(MaterialLexer, JsonMaterialParser) {
287297
int main(int argc, char** argv) {
288298
::testing::InitGoogleTest(&argc, argv);
289299
return RUN_ALL_TESTS();
290-
}
300+
}

0 commit comments

Comments
 (0)