diff options
author | Bourgond Aries <macocio@gmail.com> | 2016-03-28 06:35:39 +0200 |
---|---|---|
committer | Bourgond Aries <macocio@gmail.com> | 2016-03-28 06:35:39 +0200 |
commit | 644dc88c0410dffacb7def8cd7195edb9b382afc (patch) | |
tree | 8cba7aa5e5caff31472ad45e94a31bf61add7ad9 /src | |
parent | 33c49d03578010e10d5cf881272292558dc043dd (diff) | |
download | milf-rs-644dc88c0410dffacb7def8cd7195edb9b382afc.tar.gz milf-rs-644dc88c0410dffacb7def8cd7195edb9b382afc.zip |
Add a bunch of negative and positive tests
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -459,6 +459,34 @@ mod tests { assert_eq!(*looked, Value::Integer(1)); } + #[test] + fn single_dot() { + let value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(None, value.lookup(".")); + } + #[test] + fn array_dot() { + let value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(None, value.lookup("0.")); + } + + #[test] + fn dot_inside() { + let value: Value = "[table]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(None, value.lookup("table.\"value.0\"")); + } + + #[test] + fn table_with_quotes() { + let value: Value = "[table.\"element\"]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(None, value.lookup("\"table.element\".\"value\".0")); + } + + #[test] + fn table_with_quotes_2() { + let value: Value = "[table.\"element\"]\n\"value\" = [0, 1, 2]".parse().unwrap(); + assert_eq!(Value::Integer(0), *value.lookup("table.\"element\".\"value\".0").unwrap()); + } } |