Skip to content

Commit

Permalink
Fix handling of blank file and add test
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Helwer <2n8rn1w1f@mozmail.com>
  • Loading branch information
ahelwer committed May 17, 2024
1 parent be8e208 commit b77ffb4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ clap = { version = "4.5.4", features = ["derive"] }
csv = "1.3.0"
serde = { version = "1.0.197", features = ["derive"] }
tree-sitter = "0.22.5"
tree-sitter-tlaplus = "1.3.3"
tree-sitter-tlaplus = "1.3.6"

[dev-dependencies]
glob = "0.3.1"
Expand Down
16 changes: 16 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,20 @@ mod tests {
let actual = std::fs::read_to_string(&output_path).unwrap();
assert_eq!(expected, actual);
}

#[test]
fn test_blank_input_file() {
let project_root = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let input_path = PathBuf::from(project_root)
.join("tests")
.join("BlankFile.tla");
let output_path = input_path.clone();
let result: Result<()> = convert(
input_path.as_path(),
output_path.as_path(),
tlauc::Mode::AsciiToUnicode,
false,
);
assert!(result.is_err());
}
}
Empty file added tests/BlankFile.tla
Empty file.

0 comments on commit b77ffb4

Please sign in to comment.