aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/moe/nea
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-03-01 00:43:28 +0100
committerLinnea Gräf <nea@nea.moe>2024-03-01 00:43:28 +0100
commitb8c7e6c934ae9e0059ac1ac1455d77319dbc20c0 (patch)
treec6be858ae9bb4813f900e4832a3fba108b43c1c4 /src/test/java/moe/nea
downloadzwirn-b8c7e6c934ae9e0059ac1ac1455d77319dbc20c0.tar.gz
zwirn-b8c7e6c934ae9e0059ac1ac1455d77319dbc20c0.tar.bz2
zwirn-b8c7e6c934ae9e0059ac1ac1455d77319dbc20c0.zip
Create merger
Diffstat (limited to 'src/test/java/moe/nea')
-rw-r--r--src/test/java/moe/nea/zwirn/ZwirnTest.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/test/java/moe/nea/zwirn/ZwirnTest.java b/src/test/java/moe/nea/zwirn/ZwirnTest.java
new file mode 100644
index 0000000..2f80964
--- /dev/null
+++ b/src/test/java/moe/nea/zwirn/ZwirnTest.java
@@ -0,0 +1,51 @@
+package moe.nea.zwirn;
+
+import net.fabricmc.stitch.commands.tinyv2.*;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.HashMap;
+
+class ZwirnTest {
+
+ @Test
+ void mergeTinyFile() throws IOException {
+ var base = new TinyFile(
+ new TinyHeader(
+ Arrays.asList("official", "intermediary", "named"),
+ 2, 0, new HashMap<>()
+ ),
+ Arrays.asList(
+ new TinyClass(
+ Arrays.asList("A", "ClassA", "SomeClass"),
+ Arrays.asList(),
+ Arrays.asList(new TinyField("a",
+ Arrays.asList("a", "field_a", "myField"), Arrays.asList("Field comment"))),
+ Arrays.asList("some comment")
+ )
+ )
+ );
+ var overlay = new TinyFile(
+ new TinyHeader(
+ Arrays.asList("official", "intermediary", "named"),
+ 2, 0, new HashMap<>()
+ ),
+ Arrays.asList(
+ new TinyClass(
+ Arrays.asList("A", "A", "SomeClassButNamedBetter"),
+ Arrays.asList(),
+ Arrays.asList(new TinyField("a",
+ Arrays.asList("a", "a", "myFieldButNamedCool"), Arrays.asList("Better comment"))),
+ Arrays.asList()
+ ),
+ new TinyClass(
+ Arrays.asList("B", "B", "OtherClass")
+ )
+ )
+ );
+ var merged = Zwirn.mergeTinyFile(base, overlay, "official");
+ TinyV2Writer.write(merged, Path.of("out.tiny"));
+ }
+} \ No newline at end of file