Adds a unit test that writes a snbt file

This commit is contained in:
zontreck 2024-05-08 20:40:37 -07:00
parent 0766a43622
commit e9d4d51b70

View file

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:libac_flutter/nbt/NbtIo.dart';
import 'package:libac_flutter/nbt/NbtUtils.dart';
import 'package:libac_flutter/nbt/SnbtIo.dart';
import 'package:libac_flutter/nbt/Stream.dart';
import 'package:libac_flutter/nbt/Tag.dart';
import 'package:libac_flutter/nbt/impl/CompoundTag.dart';
@ -73,4 +74,15 @@ void main() {
Tag.writeStringifiedNamedTag(ct, sb, 0);
print(sb.toString());
});
test("Write BigTest to SNBT file", () async {
CompoundTag ct =
await NbtIo.read("${Directory.current.path}/test/bigtest.nbt");
String output = "${Directory.current.path}/build/bigtest.snbt";
File file = File(output);
SnbtIo.write(output, ct);
// Expect that the file exists
expect(file.existsSync(), true);
});
}