Fix an error with multiple consecutive space
This commit is contained in:
parent
4b8eaebdc5
commit
8a17e18e9f
2 changed files with 32 additions and 1 deletions
|
|
@ -295,7 +295,7 @@ void Parser::processOpcode()
|
||||||
bool stop = false;
|
bool stop = false;
|
||||||
|
|
||||||
// consume space characters following
|
// consume space characters following
|
||||||
while (i < valueSize && isSpaceChar(valueRaw[endPosition + 1]))
|
while (i < valueSize && isSpaceChar(valueRaw[i]))
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
// if there aren't non-space characters following, do not extract
|
// if there aren't non-space characters following, do not extract
|
||||||
|
|
|
||||||
|
|
@ -685,3 +685,34 @@ R"(<region>#define $VEL v1 sample=$VEL.wav #define $FOO bar)");
|
||||||
REQUIRE(mock.fullBlockHeaders == expectedHeaders);
|
REQUIRE(mock.fullBlockHeaders == expectedHeaders);
|
||||||
REQUIRE(mock.fullBlockMembers == expectedMembers);
|
REQUIRE(mock.fullBlockMembers == expectedMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Parsing] Opcode value with multiple consecutive spaces")
|
||||||
|
{
|
||||||
|
sfz::Parser parser;
|
||||||
|
ParsingMocker mock;
|
||||||
|
parser.setListener(&mock);
|
||||||
|
parser.parseString("/opcodeValueWithMultipleConsecutiveSpaces.sfz",
|
||||||
|
R"(<region> sample=foo bar baz .wav key=69 )");
|
||||||
|
|
||||||
|
std::vector<std::vector<sfz::Opcode>> expectedMembers = {
|
||||||
|
{{"sample", "foo bar baz .wav"},
|
||||||
|
{"key", "69"}},
|
||||||
|
};
|
||||||
|
std::vector<std::string> expectedHeaders = {
|
||||||
|
"region"
|
||||||
|
};
|
||||||
|
std::vector<sfz::Opcode> expectedOpcodes;
|
||||||
|
|
||||||
|
for (auto& members: expectedMembers)
|
||||||
|
for (auto& opcode: members)
|
||||||
|
expectedOpcodes.push_back(opcode);
|
||||||
|
|
||||||
|
REQUIRE(mock.beginnings == 1);
|
||||||
|
REQUIRE(mock.endings == 1);
|
||||||
|
REQUIRE(mock.errors.empty());
|
||||||
|
REQUIRE(mock.warnings.empty());
|
||||||
|
REQUIRE(mock.opcodes == expectedOpcodes);
|
||||||
|
REQUIRE(mock.headers == expectedHeaders);
|
||||||
|
REQUIRE(mock.fullBlockHeaders == expectedHeaders);
|
||||||
|
REQUIRE(mock.fullBlockMembers == expectedMembers);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue