test(stencilcraft-format): cover scalar JSON roots

This commit is contained in:
Dylan M. Taylor committed 2026-11-13 05:51:08 +00:00
1 parent 7c3a099ad8
commit eb379cf3d2
1 file changed
+7
+7
View File
@@ -362,6 +362,13 @@ mod tests {
}
}
#[test]
fn scalar_roots_are_not_documents() {
for text in ["false", "-1", "1", "1.5", "\"scalar\"", "null"] {
assert!(matches!(File::read(text), Err(Error::NotStencilCraft)));
}
}
#[test]
fn refuses_versions_other_than_the_current_version() {
assert!(matches!(File::read(r#"{"stencilcraft":{"name":"stencilcraft","version":2}}"#), Err(Error::Version { found: 2, supported: 1 })));