Fix SNBT Parsing and writing of single quoted strings, and strings with quotes or single quotes within.

This commit is contained in:
zontreck 2025-01-22 01:48:17 -07:00
parent bdb087fabc
commit 18e98ca918
9 changed files with 93 additions and 14 deletions

View file

@ -123,4 +123,25 @@ void main() {
await NbtIo.write(OutputNBT, tag);
expect(File(OutputNBT).existsSync(), true);
}, timeout: Timeout(Duration(hours: 90)));
test("Read Sophisticated Backpack data", () async {
CompoundTag ct = await NbtIo.read("test/sophisticatedbackpacks.dat");
// Convert to SNBT
String snbtData = SnbtIo.writeToString(ct);
// Convert snbt back to NBT
CompoundTag testData = await SnbtIo.readFromString(snbtData) as CompoundTag;
// Now, convert back to SNBT to validate
String snbtTest = SnbtIo.writeToString(testData);
if (snbtTest != snbtData) {
print(" Converted data : ${snbtTest}");
}
expect(snbtTest, snbtData);
}, timeout: Timeout(Duration(minutes: 10)));
test("Read Sophisticated Backpacks Lore Test", () async {
CompoundTag CT =
await SnbtIo.readFromFile("test/displayLoreTest.snbt") as CompoundTag;
}, timeout: Timeout(Duration(minutes: 10)));
}