This commit is contained in:
Anuken
2026-02-20 17:03:47 -05:00
parent 76dc529d23
commit 7da63ac504
2 changed files with 65 additions and 3 deletions
+44
View File
@@ -534,6 +534,50 @@ public class PatcherTests{
assertEquals(oldDamage, UnitTypes.dagger.weapons.first().bullet.damage);
}
@Test
void nestedArrays() throws Exception{
Vars.state.patcher.apply(Seq.with("""
{
"block.ship-refabricator.upgrades.0": {
"0": "dagger",
"1": "mace"
}
}
"""));
assertNoWarnings();
assertEquals(UnitTypes.dagger, ((Reconstructor)Blocks.shipRefabricator).upgrades.get(0)[0]);
assertEquals(UnitTypes.mace, ((Reconstructor)Blocks.shipRefabricator).upgrades.get(0)[1]);
resetAfter();
assertEquals(UnitTypes.elude, ((Reconstructor)Blocks.shipRefabricator).upgrades.get(0)[0]);
assertEquals(UnitTypes.avert, ((Reconstructor)Blocks.shipRefabricator).upgrades.get(0)[1]);
}
@Test
void nestedArrays2() throws Exception{
Vars.state.patcher.apply(Seq.with("""
{
"block.ship-refabricator": {
"upgrades.0.0": "dagger",
"upgrades.0.1": "mace"
}
}
"""));
assertNoWarnings();
assertEquals(UnitTypes.dagger, ((Reconstructor)Blocks.shipRefabricator).upgrades.get(0)[0]);
assertEquals(UnitTypes.mace, ((Reconstructor)Blocks.shipRefabricator).upgrades.get(0)[1]);
resetAfter();
assertEquals(UnitTypes.elude, ((Reconstructor)Blocks.shipRefabricator).upgrades.get(0)[0]);
assertEquals(UnitTypes.avert, ((Reconstructor)Blocks.shipRefabricator).upgrades.get(0)[1]);
}
@Test
void customAttribute() throws Exception{
int amount = Attribute.all.length;