mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-28 18:06:09 +02:00
chris 1.1 hotfix
This commit is contained in:
@@ -110,6 +110,56 @@ check(not silverSet["assets/generated/trade/game_boy.png"],
|
||||
check(CacheContract.VERSION_REQUIRED_FILES.yellow ~= nil,
|
||||
"Yellow has version-specific required outputs")
|
||||
|
||||
-- Revisioned cache markers: Crystal accepts either the 1.0 or the 1.1 cart.
|
||||
local CRYSTAL_1_0 = "f4cd194bdee0d04ca4eac29e09b8e4e9d818c133"
|
||||
local CRYSTAL_1_1 = "f2f52230b536214ef7c9924f483392993e226cfb"
|
||||
|
||||
eq(CacheContract.markerFor("crystal", CRYSTAL_1_1),
|
||||
CacheContract.FORMAT .. CRYSTAL_1_1,
|
||||
"markerFor with an explicit sha1 uses that sha1, not the canonical one")
|
||||
eq(CacheContract.markerFor("crystal"), CacheContract.FORMAT .. CRYSTAL_1_0,
|
||||
"markerFor with no sha1 still defaults to the canonical (1.0) sha1")
|
||||
|
||||
check(CacheContract.markerMatches("crystal", CacheContract.FORMAT .. CRYSTAL_1_0),
|
||||
"a marker written from the 1.0 hash matches crystal")
|
||||
check(CacheContract.markerMatches("crystal", CacheContract.FORMAT .. CRYSTAL_1_1),
|
||||
"a marker written from the 1.1 hash also matches crystal")
|
||||
check(not CacheContract.markerMatches("crystal",
|
||||
CacheContract.FORMAT .. "ea9bcae617fdf159b045185467ae58b2e4a48b9a"),
|
||||
"a marker written from Red's hash does not match crystal")
|
||||
check(not CacheContract.markerMatches("red", CacheContract.FORMAT .. CRYSTAL_1_1),
|
||||
"a marker written from Crystal's 1.1 hash does not match red")
|
||||
|
||||
local crystalFs = { prefix = "crystal-marker-test/", files = {} }
|
||||
function crystalFs.exists(path) return crystalFs.files[crystalFs.prefix .. path] ~= nil end
|
||||
function crystalFs.read(path) return crystalFs.files[crystalFs.prefix .. path] end
|
||||
function crystalFs.write(path, value)
|
||||
crystalFs.files[crystalFs.prefix .. path] = value
|
||||
return true
|
||||
end
|
||||
function crystalFs.remove(path) crystalFs.files[crystalFs.prefix .. path] = nil end
|
||||
|
||||
local crystalRequired = CacheContract.requiredFilesFor("crystal")
|
||||
for _, path in ipairs(crystalRequired) do
|
||||
crystalFs.files["crystal/" .. path] = true
|
||||
end
|
||||
local published11 = CacheContract.publish("crystal", crystalFs, CRYSTAL_1_1)
|
||||
check(published11, "publishing with the 1.1 sha1 succeeds")
|
||||
eq(crystalFs.files["crystal/" .. CacheContract.MARKER_PATH],
|
||||
CacheContract.FORMAT .. CRYSTAL_1_1, "the marker records the 1.1 sha1")
|
||||
check(CacheContract.isReady("crystal", crystalFs),
|
||||
"a cache published with the 1.1 sha1 still reads ready for crystal")
|
||||
|
||||
crystalFs.files["crystal/" .. CacheContract.MARKER_PATH] =
|
||||
CacheContract.FORMAT .. "ea9bcae617fdf159b045185467ae58b2e4a48b9a"
|
||||
check(not CacheContract.isReady("crystal", crystalFs),
|
||||
"a marker from another version's hash does not read ready for crystal")
|
||||
|
||||
check(CacheContract.markerMatches("blue", CacheContract.markerFor("blue")),
|
||||
"blue's own marker still matches blue")
|
||||
check(not CacheContract.markerMatches("blue", CacheContract.markerFor("red")),
|
||||
"red's marker still does not match blue")
|
||||
|
||||
-- A throwing adapter must not strand the process in its temporary prefix.
|
||||
local throwingFs = { prefix = "before/" }
|
||||
function throwingFs.exists() error("probe failed") end
|
||||
|
||||
Reference in New Issue
Block a user