binary parse test: extra words after string literal

Covers the case where the string literal is the
last operand.

TODO: Case where one more operand is expected after
the string literal.  Occurs only for the LinkageAttributes
decoration.  To test that, we need to update the grammar
as well.
This commit is contained in:
David Neto 2015-11-30 13:45:20 -05:00
parent 292acb5b41
commit 36909c05a5

View File

@ -547,6 +547,14 @@ INSTANTIATE_TEST_CASE_P(
{spvOpcodeMake(3, SpvOpString), 1, 0x41414141, 0}}),
"Invalid word count: OpString starting at word 5 says it has 3"
" words, but found 4 words instead."},
// Word count is too large. The string terminates before the last
// word.
{Concatenate({ExpectedHeaderForBound(2),
{spvOpcodeMake(4, SpvOpString), 1 /* result id */},
MakeVector("abc"),
{0 /* this word does not belong*/}}),
"Invalid instruction OpString starting at word 5: expected no more"
" operands after 3 words, but stated word count is 4."},
{Concatenate({ExpectedHeaderForBound(2),
{spvOpcodeMake(2, SpvOpTypeVoid), 0}}),
"Error: Result Id is 0"},