Add advanced lookup for table names

This commit is contained in:
Bourgond Aries 2016-03-27 20:55:49 +02:00
parent 770052a9a7
commit 442f663c2d

View file

@ -445,6 +445,13 @@ mod tests {
assert_eq!(*looked, Value::Integer(0)); assert_eq!(*looked, Value::Integer(0));
} }
#[test]
fn lookup_advanced_table() {
let value: Value = r#"[table."name.other"] value = "my value""#.parse().unwrap();
let looked = value.lookup(r#"table."name.other".value"#).unwrap();
assert_eq!(*looked, Value::String(String::from("my value")));
}
#[test] #[test]
fn lookup_mut_advanced() { fn lookup_mut_advanced() {
let mut value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap(); let mut value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap();