()
| 236 | |
| 237 | #[test] |
| 238 | fn array_length_function() { |
| 239 | // Test via expression evaluator directly. |
| 240 | let expr = nodedb_query::expr_parse::parse_generated_expr("array_length(tags)") |
| 241 | .unwrap() |
| 242 | .0; |
| 243 | let doc = nodedb_types::Value::from(serde_json::json!({"tags": ["a", "b", "c"]})); |
| 244 | assert_eq!(expr.eval(&doc), nodedb_types::Value::Integer(3)); |
| 245 | |
| 246 | let doc2 = nodedb_types::Value::from(serde_json::json!({"tags": []})); |
| 247 | assert_eq!(expr.eval(&doc2), nodedb_types::Value::Integer(0)); |
| 248 | } |
| 249 | |
| 250 | #[test] |
| 251 | fn array_append_function() { |
nothing calls this directly
no test coverage detected