mirror of
https://gitee.com/openharmony/third_party_spirv-tools
synced 2024-11-30 02:51:03 +00:00
Fixed use-after-free in isStartOfNewInst() tests.
This commit is contained in:
parent
7ffd8ffeb2
commit
ca50510ad4
@ -41,19 +41,22 @@ TEST(TextStartsWithOp, YesAtStart) {
|
||||
|
||||
TEST(TextStartsWithOp, YesAtMiddle) {
|
||||
{
|
||||
AssemblyContext dat(AutoText(" OpFoo"), nullptr);
|
||||
AutoText text(" OpFoo");
|
||||
AssemblyContext dat(text, nullptr);
|
||||
dat.seekForward(2);
|
||||
EXPECT_TRUE(dat.isStartOfNewInst());
|
||||
}
|
||||
{
|
||||
AssemblyContext dat(AutoText("xx OpFoo"), nullptr);
|
||||
AutoText text("xx OpFoo");
|
||||
AssemblyContext dat(text, nullptr);
|
||||
dat.seekForward(2);
|
||||
EXPECT_TRUE(dat.isStartOfNewInst());
|
||||
}
|
||||
}
|
||||
|
||||
TEST(TextStartsWithOp, NoIfTooFar) {
|
||||
AssemblyContext dat(AutoText(" OpFoo"), nullptr);
|
||||
AutoText text(" OpFoo");
|
||||
AssemblyContext dat(text, nullptr);
|
||||
dat.seekForward(3);
|
||||
EXPECT_FALSE(dat.isStartOfNewInst());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user