aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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]