Say where a missing snippet reference is read from

A reference is snippet/<name>, a file below snippet/<snippet folder>/. A
pack still written as snippet/decorator/bush, in the layout from before the
folder was iris/decorant/decorator, was reported as having no file
snippet/iris/decorant/decorator/decorator/bush.json, which reads like a
doubled path in the lookup. The lookup is right; the message now names the
folder the name is relative to.
This commit is contained in:
piexel committed 2026-11-06 14:30:27 +01:00
1 parent 28d9c34dd2
commit ce7f782561
2 files changed
+15 -1

No files matched your search

@@ -174,6 +174,19 @@ public class ModuleSettingsDecoderTest {
assertTrue(missing.getMessage(), missing.getMessage().contains("Snippet snippet/narrow has no file snippet/moss-patch/narrow.json"));
}
@Test
public void aReferenceIsReadBelowTheSnippetFolderAndAMissingFileSaysSo() throws IOException {
Path oldLayout = Files.createDirectories(packFolder.resolve("snippet/patches"));
Files.writeString(oldLayout.resolve("wide.json"), "{\"size\": 9}");
IllegalArgumentException missing = assertThrows(IllegalArgumentException.class,
() -> moss("{\"moss\": {\"patch\": \"snippet/patches/wide\"}}"));
assertTrue(missing.getMessage(), missing.getMessage().contains(
"Snippet snippet/patches/wide has no file snippet/moss-patch/patches/wide.json; "
+ "a snippet reference names a file below snippet/moss-patch/"));
}
@Test
public void snippetReferencesMayNameTheSnippetFolderAsIrisSnippetsDo() throws IOException {
Path snippets = Files.createDirectories(packFolder.resolve("snippet/moss-patch"));