tests/model: comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:50:23 -05:00
1 parent 5f7f6005f6
commit fe7566cbba
37 files changed
+72 -440

No files matched your search

+1 -12
View File
@@ -1,7 +1,4 @@
-- model/rbxm tests: binary models and places built by rojo 7.7 and lune 0.11 (rbx-dom) decode to the values lune reads
-- from them (every property the files hold); the binary decode equals the decode of the XML twin; Zstandard and raw
-- chunk variants; an unknown chunk and an unknown property type round trip raw; our rbxm output read back by lune
-- equals the original (fixture verdicts); round trips of a tree with every type; options, errors and the fuzz pass.
-- model/rbxm tests: rojo 7.7 / lune 0.11 binary models and places against lune's reading and their XML twins.
-- Fixtures: tools/fixtures/rbxmx.py.
local T = require("@tests/T")
local Rbxm = require("@rosetta/model/rbxm")
@@ -33,7 +30,6 @@ local function file(name: string): any
error("no fixture " .. name)
end
-- every binary reference file against lune's reading of it, and against the decode of its XML twin
local nprops = 0
local trees: { [string]: any } = {}
for _, f in Fx.files do
@@ -109,7 +105,6 @@ do
t:eq(#Rbx.list(tree), 1 + 12 + 2 + 120, "every instance")
end
-- chunk variants: Zstandard, raw, an unknown chunk and an unknown property type
do
local base = trees["model.rbxm"]
t:eq(table.concat(base.meta.source.compression, ","), "lz4,none", "rojo: lz4 chunks (END raw)")
@@ -153,7 +148,6 @@ do
t:check(edited and not still, "a raw column is dropped when its class changes")
end
-- our encoder: lune reads our rbxm back to the same values (tools/fixtures/rbxmx.py)
local nours = 0
for _, v in Ours do
if string.sub(v.name, -5) == "/rbxm" then
@@ -163,7 +157,6 @@ for _, v in Ours do
end
t:note("%d of our rbxm files read back by lune", nours)
-- round trips: every reference file, and a tree with every type
for name, tree in trees do
local out, err = Rbxm.encode(tree)
t:check(out ~= nil, name .. ": encode " .. tostring(err))
@@ -183,7 +176,6 @@ do
H.sameTree(t, tree, back2, "every type, raw chunks", { loose = true })
t:eq(table.concat(back2.meta.source.compression, ","), "none", "compression = none")
t:check(buffer.len(raw) > buffer.len(out), "lz4 chunks are smaller")
-- through XML and back
local viaXml = Rbxmx.decode(Bytes.reader(Rbxmx.encode(back) :: buffer))
H.sameTree(t, tree, decode(Rbxm.encode(viaXml) :: buffer), "every type via rbxmx", { loose = true })
-- a place: roots marked as services
@@ -198,7 +190,6 @@ do
t:eq(decode(Rbxm.encode(tree) :: buffer).metadata.ExplicitAutoJoints, "true", "META")
end
-- sniff, errors
do
local data = file("model.rbxm").data
t:eq(Rbxm.sniff(Bytes.reader(buffer.fromstring(data))), 1, "sniff")
@@ -240,7 +231,6 @@ do
t:check(e8 and e8.code == Err.CORRUPT, "a cycle: " .. tostring(e8))
end
-- through the api: detection (variant: rbxl for places), load, save, convert
do
local F = require("@rosetta")
t:eq(F.detect(file("place.rbxl").data), "rbxl", "detect a place")
@@ -257,7 +247,6 @@ do
t:eq(F.detect(l), "rbxl", "save as rbxl marks services")
end
-- fuzz
do
local samples = { file("model-raw.rbxm").data, Rbxm.encode(H.everything(), { compression = "none" }) :: buffer, Rbxm.encode(H.everything()) :: buffer }
t:fuzz("decode", function(b: buffer)