From 2a6b365f7c931feb5e870d54c6d4a02e8aee75bf Mon Sep 17 00:00:00 2001 From: Alan Du Date: Wed, 31 May 2017 00:30:19 +0100 Subject: Error when trying to serialize invalid float --- tests/invalid-encoder-misc.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/invalid-encoder-misc.rs (limited to 'tests') diff --git a/tests/invalid-encoder-misc.rs b/tests/invalid-encoder-misc.rs new file mode 100644 index 0000000..272f58f --- /dev/null +++ b/tests/invalid-encoder-misc.rs @@ -0,0 +1,14 @@ +extern crate toml; + +use std::f64; + +#[test] +fn test_invalid_float_encode() { + fn bad(value: toml::Value) { + assert!(toml::to_string(&value).is_err()); + } + + bad(toml::Value::Float(f64::INFINITY)); + bad(toml::Value::Float(f64::NEG_INFINITY)); + bad(toml::Value::Float(f64::NAN)); +} -- cgit v1.2.3