From 3d399ff1af368713086079e059426708ec2f7488 Mon Sep 17 00:00:00 2001 From: dev747368 <48332326+dev747368@users.noreply.github.com> Date: Mon, 17 Nov 2025 20:21:59 +0000 Subject: [PATCH] GP-0 junit test for GP-6106 go apisnapshot fallback --- .../bin/format/golang/rtti/GoApiSnapshotTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/golang/rtti/GoApiSnapshotTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/golang/rtti/GoApiSnapshotTest.java index 55b9fe1a71..853108e528 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/golang/rtti/GoApiSnapshotTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/golang/rtti/GoApiSnapshotTest.java @@ -23,6 +23,7 @@ import java.io.IOException; import org.junit.Test; import generic.test.AbstractGenericTest; +import ghidra.app.util.bin.ByteProvider; import ghidra.app.util.bin.format.golang.GoVer; import ghidra.app.util.bin.format.golang.rtti.GoApiSnapshot.*; import ghidra.util.exception.CancelledException; @@ -46,7 +47,19 @@ public class GoApiSnapshotTest extends AbstractGenericTest { assertNotNull(runtimeType); assertTrue(runtimeType instanceof GoStructDef || runtimeType instanceof GoAliasDef); } + } + @Test + public void testSnapshotFallback() throws CancelledException, IOException { + // test to make sure that we can get an apisnapshot file for a patch version that has not + // been encountered before + for (GoVer goMinorVer : GoRttiMapper.SUPPORTED_VERSIONS.asList()) { + ByteProvider snapshot = GoApiSnapshot.getApiSnapshotJsonFile( + goMinorVer.withPatch(99 /* large patch number, unlikely to ever be encountered*/), + TaskMonitor.DUMMY); + assertNotNull(snapshot); + snapshot.close(); + } } }