aboutsummaryrefslogtreecommitdiff
path: root/tests/encoder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/encoder.rs')
-rw-r--r--tests/encoder.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/encoder.rs b/tests/encoder.rs
index eda6296..e76a74a 100644
--- a/tests/encoder.rs
+++ b/tests/encoder.rs
@@ -10,7 +10,10 @@ impl toml_test_harness::Encoder for Encoder {
fn encode(&self, data: toml_test_harness::Decoded) -> Result<String, toml_test_harness::Error> {
let value = from_decoded(&data)?;
- let s = toml::to_string(&value).map_err(toml_test_harness::Error::new)?;
+ let toml::Value::Table(document) = value else {
+ return Err(toml_test_harness::Error::new("no root table"));
+ };
+ let s = toml::to_string(&document).map_err(toml_test_harness::Error::new)?;
Ok(s)
}
}