Skip to content

Commit

Permalink
test: add unit test for transform_code function
Browse files Browse the repository at this point in the history
  • Loading branch information
MahadMuhammad committed Jul 3, 2024
1 parent b177ff7 commit 716b6e9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,13 @@ fn transform_code(code: &String, dg_directive: &str) -> Vec<String> {
}
new_code
}

#[test]
fn test_transform_code() {
let dg_msg = "// { dg-error \"expected one of `:`, `@`, or `|`, found `)`\" }";
let rust_msg = "//~^ ERROR expected one of `:`, `@`, or `|`, found `)`";
assert_eq!(
transform_code(&rust_msg.to_string(), DG_ERROR),
vec![dg_msg.to_string()]
);
}

0 comments on commit 716b6e9

Please sign in to comment.