Skip to content

Commit

Permalink
lbinixf: add testing identifier or for parsing attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Jan 23, 2024
1 parent ccf9815 commit d54209f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions libnixf/test/Parse/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,23 @@ TEST(Parser, RecAttrsMissingLCurly) {
ASSERT_EQ(F2.newText(), "}");
}

TEST(Parser, AttrsOrID) {
auto Src = R"({ or = 1; })"sv;

std::vector<Diagnostic> Diags;
auto AST = nixf::parse(Src, Diags);

ASSERT_TRUE(AST);
ASSERT_EQ(AST->kind(), Node::NK_ExprAttrs);
ASSERT_TRUE(AST->range().begin().isAt(0, 0, 0));
ASSERT_TRUE(AST->range().end().isAt(0, 11, 11));
ASSERT_FALSE(static_cast<ExprAttrs *>(AST.get())->isRecursive());

ASSERT_EQ(Diags.size(), 1);
auto &D = Diags[0];
ASSERT_TRUE(D.range().begin().isAt(0, 2, 2));
ASSERT_TRUE(D.range().end().isAt(0, 4, 4));
ASSERT_EQ(D.kind(), Diagnostic::DK_OrIdentifier);
}

} // namespace

0 comments on commit d54209f

Please sign in to comment.