Skip to content

Commit

Permalink
libnixf: check diagnostic range for parsing string
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Jan 13, 2024
1 parent 371a059 commit 6965771
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libnixf/lib/Parse/test/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ TEST(Parser, StringMissingDQuote) {
// Check the diagnostic.
ASSERT_EQ(Diags.diags().size(), 1);
auto &D = Diags.diags()[0];
ASSERT_EQ(D->range().Begin, Src.begin() + 4);
ASSERT_EQ(D->range().End, Src.begin() + 4);
ASSERT_EQ(D->kind(), Diagnostic::DK_Expected);
ASSERT_EQ(D->args().size(), 1);
ASSERT_EQ(D->args()[0], "\" to close string literal");

// Check the note.
ASSERT_EQ(D->notes().size(), 1);
auto &N = D->notes()[0];
ASSERT_EQ(N->range().Begin, Src.begin() + 0);
ASSERT_EQ(N->range().End, Src.begin() + 0);
ASSERT_EQ(N->kind(), Note::NK_ToMachThis);
ASSERT_EQ(N->args().size(), 1);
ASSERT_EQ(N->args()[0], "\"");
Expand Down

0 comments on commit 6965771

Please sign in to comment.