Add test cases

This commit is contained in:
LoukasPap
2026-02-08 18:48:17 +01:00
committed by Sylvestre Ledru
parent 1c57aaa8e2
commit 361c45e6c3
2 changed files with 22 additions and 0 deletions
+13
View File
@@ -2725,6 +2725,19 @@ mod tests {
}
}
#[test]
fn test_compile_text_command_posix_incomplete() {
let (mut lines, mut chars) = make_providers("i\\");
let mut cmd = Command::default();
let mut context = ProcessingContext {
posix: true,
..Default::default()
};
let result = compile_text_command(&mut lines, &mut chars, &mut cmd, &mut context);
let err = result.unwrap_err().to_string();
assert!(err.contains("incomplete command"));
}
#[test]
fn test_compile_text_command_gnu_optional_backslash() {
let mut chars = make_char_provider("athere");
+9
View File
@@ -1066,6 +1066,15 @@ fn test_undefined_label() {
.stderr_is("sed: <script argument 1>:1:1: error: undefined label `foo'\n");
}
#[test]
fn test_incomplete_test_command_posix() {
new_ucmd!()
.args(&["--posix", "i\\"])
.fails()
.code_is(1)
.stderr_is("sed: :0:3: error: incomplete command\n");
}
#[test]
fn test_addr0_non_posix() {
new_ucmd!()