Skip to content

Commit 6d25bce

Browse files
committed
add more test cases
1 parent d4eec7d commit 6d25bce

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/common/jsonb/tests/it/functions.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use common_jsonb::object_keys;
3232
use common_jsonb::parse_json_path;
3333
use common_jsonb::parse_value;
3434
use common_jsonb::to_string;
35+
use common_jsonb::Error;
3536
use common_jsonb::JsonPath;
3637
use common_jsonb::Number;
3738
use common_jsonb::Object;
@@ -374,6 +375,18 @@ fn test_parse_json_path() {
374375
let path = parse_json_path(s.as_bytes()).unwrap();
375376
assert_eq!(&path[..], &expect[..]);
376377
}
378+
379+
let wrong_sources = vec![
380+
(r#"\"\"\\k1\"\""#, Error::InvalidToken),
381+
(r#"\\k1\\'"#, Error::InvalidToken),
382+
];
383+
for (s, expect) in wrong_sources {
384+
let path = parse_json_path(s.as_bytes());
385+
match path {
386+
Ok(_) => println!(),
387+
Err(_) => assert_eq!(Error::InvalidToken, expect),
388+
}
389+
}
377390
}
378391

379392
#[test]

0 commit comments

Comments
 (0)