✨ updates
This commit is contained in:
parent
77185abd6a
commit
b1ad069731
4 changed files with 114 additions and 8 deletions
64
src/test.rs
64
src/test.rs
|
@ -109,6 +109,70 @@ mod tests {
|
|||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_contains() {
|
||||
assert!(matches(
|
||||
&json!({
|
||||
"key": {
|
||||
"$contains": "world"
|
||||
}
|
||||
}),
|
||||
&json!({
|
||||
"key": "hello world"
|
||||
})
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn range_op() {
|
||||
assert!(matches(
|
||||
&json!({"key": { "$range": [18, 30] }}),
|
||||
&json!({
|
||||
"key": 20
|
||||
})
|
||||
));
|
||||
|
||||
assert!(!matches(
|
||||
&json!({"key": { "$range": [18, 30] }}),
|
||||
&json!({
|
||||
"key": 15
|
||||
})
|
||||
));
|
||||
|
||||
assert!(!matches(
|
||||
&json!({"key": { "$range": [18, 30] }}),
|
||||
&json!({
|
||||
"key": 40
|
||||
})
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_array_contains() {
|
||||
assert!(matches(
|
||||
&json!({
|
||||
"key": {
|
||||
"$contains": 3
|
||||
}
|
||||
}),
|
||||
&json!({
|
||||
"key": [1,2,3,4,5]
|
||||
})
|
||||
));
|
||||
|
||||
assert!(matches(
|
||||
&json!({
|
||||
"$not": {
|
||||
"key": {
|
||||
"$contains": 3
|
||||
}}
|
||||
}),
|
||||
&json!({
|
||||
"key": [1,2,4,5]
|
||||
})
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_array() {
|
||||
assert!(matches(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue