Raise an explicit panic when context_lines is 0. Fixes #37

This commit is contained in:
Armin Ronacher 2022-07-28 15:14:54 +02:00
parent 3c784d6e9d
commit 3a938ae1d3
3 changed files with 13 additions and 1 deletions

View file

@ -758,3 +758,12 @@ fn test_serde_ops() {
let json = serde_json::to_string_pretty(&changes).unwrap();
insta::assert_snapshot!(&json);
}
#[test]
#[should_panic = "n must be 1 or larger"]
fn test_regression_issue_37() {
let config = TextDiffConfig::default();
let diff = config.diff_lines("", "");
let mut output = diff.unified_diff();
output.context_radius(0).to_string();
}