// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details #include "Luau/BuiltinDefinitions.h" #include "Luau/Type.h" #include "Fixture.h" #include "doctest.h" using namespace Luau; TEST_SUITE_BEGIN("BuiltinDefinitionsTest"); TEST_CASE_FIXTURE(BuiltinsFixture, "lib_documentation_symbols") { CHECK(!frontend.globals.globalScope->bindings.empty()); for (const auto& [name, binding] : frontend.globals.globalScope->bindings) { std::string nameString(name.c_str()); std::string expectedRootSymbol = "@luau/global/" + nameString; std::optional actualRootSymbol = binding.documentationSymbol; CHECK_MESSAGE( actualRootSymbol == expectedRootSymbol, "expected symbol ", expectedRootSymbol, " for global ", nameString, ", got ", actualRootSymbol); const TableType::Props* props = nullptr; if (const TableType* ttv = get(binding.typeId)) { props = &ttv->props; } else if (const ClassType* ctv = get(binding.typeId)) { props = &ctv->props; } if (props) { for (const auto& [propName, prop] : *props) { std::string fullPropName = nameString + "." + propName; std::string expectedPropSymbol = expectedRootSymbol + "." + propName; std::optional actualPropSymbol = prop.documentationSymbol; CHECK_MESSAGE(actualPropSymbol == expectedPropSymbol, "expected symbol ", expectedPropSymbol, " for ", fullPropName, ", got ", actualPropSymbol); } } } }