diff --git a/crates/stencilcraft-format/src/lib.rs b/crates/stencilcraft-format/src/lib.rs index 3ff499124..1395e1b8a 100644 --- a/crates/stencilcraft-format/src/lib.rs +++ b/crates/stencilcraft-format/src/lib.rs @@ -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 })));