Skip to content

Commit

Permalink
libnixf: sync tokens, add basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Jan 24, 2024
1 parent 865c67c commit 8e9343c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion libnixf/test/Parse/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,24 @@ rec {

ASSERT_TRUE(AST);

// TODO!!!
ASSERT_EQ(Diags.size(), 1);
const auto &D = Diags[0];
ASSERT_TRUE(D.range().begin().isAt(2, 2, 9));
ASSERT_TRUE(D.range().end().isAt(3, 13, 26));
ASSERT_EQ(D.kind(), Diagnostic::DK_UnexpectedText);
ASSERT_EQ(D.args().size(), 0);

// Check the note.
ASSERT_EQ(D.notes().size(), 0);

// Check fix-it hints.
ASSERT_EQ(D.fixes().size(), 1);
ASSERT_EQ(D.fixes()[0].edits().size(), 1);
ASSERT_EQ(D.fixes()[0].message(), "remove unexpected text");
const auto &F = D.fixes()[0].edits()[0];
ASSERT_TRUE(F.oldRange().begin().isAt(2, 2, 9));
ASSERT_TRUE(F.oldRange().end().isAt(3, 13, 26));
ASSERT_EQ(F.newText(), "");
}

} // namespace

0 comments on commit 8e9343c

Please sign in to comment.