aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBourgond Aries <macocio@gmail.com>2016-03-25 17:43:32 +0100
committerBourgond Aries <macocio@gmail.com>2016-03-25 17:43:32 +0100
commitb171205c57f6b8cd7eb3a175946293ab5b41988f (patch)
treee1b8c4d748c94b2eb79f3348c9b35fc56a0b351c
parent32969ca891a3021587863f0ec0b89ed7151d23b2 (diff)
downloadmilf-rs-b171205c57f6b8cd7eb3a175946293ab5b41988f.tar.gz
milf-rs-b171205c57f6b8cd7eb3a175946293ab5b41988f.zip
Add a test to see if the table's contents have changed
-rw-r--r--src/lib.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d81b9cd..8afaa3d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -280,6 +280,28 @@ mod tests {
use super::Value;
#[test]
+ fn lookup_mut_change() {
+ let toml = r#"
+ [test]
+ foo = "bar"
+
+ [[values]]
+ foo = "baz"
+
+ [[values]]
+ foo = "qux"
+ "#;
+
+ let mut value: Value = toml.parse().unwrap();
+ {
+ let foo = value.lookup_mut("values.0.foo").unwrap();
+ *foo = Value::String(String::from("bar"));
+ }
+ let foo = value.lookup("values.0.foo").unwrap();
+ assert_eq!(foo.as_str().unwrap(), "bar");
+ }
+
+ #[test]
fn lookup_mut_valid() {
let toml = r#"
[test]