mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add test case
This commit is contained in:
parent
f2b334a4bb
commit
54181fa86b
1 changed files with 26 additions and 0 deletions
|
@ -336,4 +336,30 @@ local s : Cls = GetCls()
|
||||||
LUAU_REQUIRE_NO_ERRORS(result);
|
LUAU_REQUIRE_NO_ERRORS(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE_FIXTURE(Fixture, "class_definition_overload_metamethods")
|
||||||
|
{
|
||||||
|
loadDefinition(R"(
|
||||||
|
declare class Vector3
|
||||||
|
end
|
||||||
|
|
||||||
|
declare class CFrame
|
||||||
|
function __mul(self, other: CFrame): CFrame
|
||||||
|
function __mul(self, other: Vector3): Vector3
|
||||||
|
end
|
||||||
|
|
||||||
|
declare function newVector3(): Vector3
|
||||||
|
declare function newCFrame(): CFrame
|
||||||
|
)");
|
||||||
|
|
||||||
|
CheckResult result = check(R"(
|
||||||
|
local base = newCFrame()
|
||||||
|
local shouldBeCFrame = base * newCFrame()
|
||||||
|
local shouldBeVector = base * newVector3()
|
||||||
|
)");
|
||||||
|
|
||||||
|
LUAU_REQUIRE_NO_ERRORS(result);
|
||||||
|
CHECK_EQ(toString(requireType("shouldBeCFrame")), "CFrame");
|
||||||
|
CHECK_EQ(toString(requireType("shouldBeVector")), "Vector3");
|
||||||
|
}
|
||||||
|
|
||||||
TEST_SUITE_END();
|
TEST_SUITE_END();
|
||||||
|
|
Loading…
Add table
Reference in a new issue