feat(test): add real UE 5.8 RunLuaTests commandlet, Lua.RunTests command, and fix UnLua .d.ts math/UObject bugs

This commit is contained in:
szy73711 committed 2026-11-29 15:05:35 +08:00
1 parent 3dd61c32a9
commit 96e3f0d009
29 files changed
+1417 -134

No files matched your search

+34 -11
View File
@@ -281,7 +281,7 @@ local function CreateMockTArray()
local i = 0
while i < #data do
if data[i + 1] == item then
return 0
return i + 1
end
i = i + 1
end
@@ -566,27 +566,47 @@ local function CreateMockFVector(x, y, z)
end,
Add = function(self, other)
if type(other) == "number" then
return CreateMockFVector(self.X + other, self.Y + other, self.Z + other)
self.X = self.X + other
self.Y = self.Y + other
self.Z = self.Z + other
else
self.X = self.X + other.X
self.Y = self.Y + other.Y
self.Z = self.Z + other.Z
end
return CreateMockFVector(self.X + other.X, self.Y + other.Y, self.Z + other.Z)
end,
Sub = function(self, other)
if type(other) == "number" then
return CreateMockFVector(self.X - other, self.Y - other, self.Z - other)
self.X = self.X - other
self.Y = self.Y - other
self.Z = self.Z - other
else
self.X = self.X - other.X
self.Y = self.Y - other.Y
self.Z = self.Z - other.Z
end
return CreateMockFVector(self.X - other.X, self.Y - other.Y, self.Z - other.Z)
end,
Mul = function(self, other)
if type(other) == "number" then
return CreateMockFVector(self.X * other, self.Y * other, self.Z * other)
self.X = self.X * other
self.Y = self.Y * other
self.Z = self.Z * other
else
self.X = self.X * other.X
self.Y = self.Y * other.Y
self.Z = self.Z * other.Z
end
return CreateMockFVector(self.X * other.X, self.Y * other.Y, self.Z * other.Z)
end,
Div = function(self, other)
if type(other) == "number" then
return CreateMockFVector(self.X / other, self.Y / other, self.Z / other)
self.X = self.X / other
self.Y = self.Y / other
self.Z = self.Z / other
else
self.X = self.X / other.X
self.Y = self.Y / other.Y
self.Z = self.Z / other.Z
end
return CreateMockFVector(self.X / other.X, self.Y / other.Y, self.Z / other.Z)
end,
Dot = function(self, other)
return self.X * other.X + self.Y * other.Y + self.Z * other.Z
@@ -880,8 +900,8 @@ function ____exports.InstallIfNeeded()
Normal = CreateMockFVector(0, 0, 1)
} end,
FActorSpawnParameters = function() return {Name = "", bNoFail = false, SpawnCollisionHandlingOverride = 0} end,
FWeakObjectPtr = function()
local refObj = nil
FWeakObjectPtr = function(initialObj)
local refObj = initialObj
return {
Set = function(self, o)
refObj = o
@@ -1050,6 +1070,9 @@ function ____exports.InstallIfNeeded()
hit.Distance = dist * 0.5
hit.Location = CreateMockFVector((startVec.X + endVec.X) * 0.5, (startVec.Y + endVec.Y) * 0.5, (startVec.Z + endVec.Z) * 0.5)
hit.ImpactPoint = hit.Location
if outHit ~= nil then
return bHit, nil
end
return bHit, hit
end
}
+18 -8
View File
@@ -127,26 +127,36 @@ function ____exports.GetSummary()
end
return {total = #results, passed = passed, failed = failed, results = results}
end
function ____exports.PrintReport()
local summary = ____exports.GetSummary()
function ____exports.FormatReport(summary)
local s = summary or ____exports.GetSummary()
local lines = {}
local lastSuite = ""
do
local i = 0
while i < #summary.results do
local r = summary.results[i + 1]
while i < #s.results do
local r = s.results[i + 1]
if r.suite ~= lastSuite then
lastSuite = r.suite
print(string.format("\n[%s]", r.suite))
lines[#lines + 1] = ""
lines[#lines + 1] = string.format("[%s]", r.suite)
end
if r.passed then
print(string.format(" PASS %s", r.name))
lines[#lines + 1] = string.format(" PASS %s", r.name)
else
print(string.format(" FAIL %s\n -> %s", r.name, r.errorMessage or "unknown error"))
lines[#lines + 1] = string.format(" FAIL %s\n -> %s", r.name, r.errorMessage or "unknown error")
end
i = i + 1
end
end
print(string.format("\n========================================\nTotal: %d | Passed: %d | Failed: %d\n========================================", summary.total, summary.passed, summary.failed))
lines[#lines + 1] = ""
lines[#lines + 1] = "========================================"
lines[#lines + 1] = string.format("Total: %d | Passed: %d | Failed: %d", s.total, s.passed, s.failed)
lines[#lines + 1] = "========================================"
return table.concat(lines, "\n")
end
function ____exports.PrintReport()
local summary = ____exports.GetSummary()
print(____exports.FormatReport(summary))
return summary
end
return ____exports