diff options
author | Bourgond Aries <macocio@gmail.com> | 2016-03-25 17:43:32 +0100 |
---|---|---|
committer | Bourgond Aries <macocio@gmail.com> | 2016-03-25 17:43:32 +0100 |
commit | b171205c57f6b8cd7eb3a175946293ab5b41988f (patch) | |
tree | e1b8c4d748c94b2eb79f3348c9b35fc56a0b351c /src | |
parent | 32969ca891a3021587863f0ec0b89ed7151d23b2 (diff) | |
download | milf-rs-b171205c57f6b8cd7eb3a175946293ab5b41988f.tar.gz milf-rs-b171205c57f6b8cd7eb3a175946293ab5b41988f.zip |
Add a test to see if the table's contents have changed
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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] |