From 81110152fb3567c21be080d1d780aeaae3847a0b Mon Sep 17 00:00:00 2001 From: Kat Lim Ruiz Date: Tue, 1 Apr 2025 18:08:04 -0500 Subject: [PATCH] add unit test for unbounded --- query-grammar/src/user_input_ast.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/query-grammar/src/user_input_ast.rs b/query-grammar/src/user_input_ast.rs index 3a94f7c4d..b427d763e 100644 --- a/query-grammar/src/user_input_ast.rs +++ b/query-grammar/src/user_input_ast.rs @@ -333,6 +333,21 @@ mod tests { ); } + #[test] + fn test_range_leaf_unbounded_serialization() { + let range = UserInputLeaf::Range { + field: Some("price".to_string()), + lower: UserInputBound::Inclusive("10".to_string()), + upper: UserInputBound::Unbounded, + }; + let ast = UserInputAst::Leaf(Box::new(range)); + let json = serde_json::to_string(&ast).unwrap(); + assert_eq!( + json, + r#"{"Leaf":{"type":"Range","field":"price","lower":{"type":"Inclusive","value":"10"},"upper":{"type":"Unbounded"}}}"# + ); + } + #[test] fn test_boost_serialization() { let inner_ast = UserInputAst::Leaf(Box::new(UserInputLeaf::All));