From bd19a9779e59573c822f43644d1436dfd2d5d7d5 Mon Sep 17 00:00:00 2001 From: JohnnyMorganz Date: Sun, 12 May 2024 13:33:19 +0200 Subject: [PATCH] Add test case --- tests/AstQuery.test.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/AstQuery.test.cpp b/tests/AstQuery.test.cpp index 769637a51..4deaf6480 100644 --- a/tests/AstQuery.test.cpp +++ b/tests/AstQuery.test.cpp @@ -331,4 +331,15 @@ TEST_CASE_FIXTURE(Fixture, "find_expr_ancestry") CHECK(ancestry.back()->is()); } +TEST_CASE_FIXTURE(BuiltinsFixture, "find_binding_at_position_global_start_of_file") +{ + check("local x = string.char(1)"); + const Position pos(0, 12); + + std::optional binding = findBindingAtPosition(*getMainModule(), *getMainSourceModule(), pos); + + REQUIRE(binding); + CHECK_EQ(binding->location, Location{Position{0, 0}, Position{0, 0}}); +} + TEST_SUITE_END();