From cecea7785b280a7255c8c8aecc7820a7764f446c Mon Sep 17 00:00:00 2001 From: JohnnyMorganz Date: Sat, 22 Oct 2022 14:37:30 +0100 Subject: [PATCH] Add more tests --- tests/AstQuery.test.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/AstQuery.test.cpp b/tests/AstQuery.test.cpp index f22769a0..a642334a 100644 --- a/tests/AstQuery.test.cpp +++ b/tests/AstQuery.test.cpp @@ -107,6 +107,38 @@ TEST_CASE_FIXTURE(DocumentationSymbolFixture, "overloaded_class_method") CHECK_EQ(symbol, "@test/globaltype/Foo.bar/overload/(Foo, string) -> number"); } +TEST_CASE_FIXTURE(DocumentationSymbolFixture, "table_function_prop") +{ + loadDefinition(R"( + declare Foo: { + new: (number) -> string + } + )"); + + std::optional symbol = getDocSymbol(R"( + Foo.new("asdf") + )", + Position(1, 13)); + + CHECK_EQ(symbol, "@test/global/Foo.new"); +} + +TEST_CASE_FIXTURE(DocumentationSymbolFixture, "table_overloaded_function_prop") +{ + loadDefinition(R"( + declare Foo: { + new: ((number) -> string) & ((string) -> number) + } + )"); + + std::optional symbol = getDocSymbol(R"( + Foo.new("asdf") + )", + Position(1, 13)); + + CHECK_EQ(symbol, "@test/global/Foo.new/overload/(string) -> number"); +} + TEST_SUITE_END(); TEST_SUITE_BEGIN("AstQuery");