Skip to content

Commit

Permalink
fix(pilota-thrift-parser): add the list end blank test case for annot…
Browse files Browse the repository at this point in the history
…ation parser
  • Loading branch information
Ggiggle committed Nov 4, 2024
1 parent 6e78a7f commit 40e2fbb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 9 additions & 0 deletions pilota-thrift-parser/src/parser/annotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,14 @@ mod tests {
#[test]
fn test_annotations() {
let _a = Annotations::parse(r#"(go.tag = "json:\"Ids\" split:\"type=tenant\"")"#).unwrap();

let input = r#"(
cpp.type = "DenseFoo",
python.type = "DenseFoo",
java.final = "",
)"#;
let (remain, a) = Annotations::parse(input).unwrap();
assert!(remain.is_empty());
assert_eq!(a.len(), 3);
}
}
10 changes: 2 additions & 8 deletions pilota-thrift-parser/src/parser/struct_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,8 @@ mod tests {
let str = r#"struct ImMsgContent {
1: string user_id (go.tag = 'json:\"user_id,omitempty\"'),
2: string __files (go.tag = 'json:\"__files,omitempty\"'),
}
(
cpp.type = "DenseFoo",
python.type = "DenseFoo",
java.final = "",
)"#;
let (remain, _) = Struct::parse(str).unwrap();
assert!(remain.is_empty());
}"#;
Struct::parse(str).unwrap();
}

#[test]
Expand Down

0 comments on commit 40e2fbb

Please sign in to comment.