mirror of
https://github.com/uutils/sed.git
synced 2026-06-10 16:14:15 -07:00
Add test cases
This commit is contained in:
committed by
Sylvestre Ledru
parent
1c57aaa8e2
commit
361c45e6c3
@@ -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");
|
||||
|
||||
@@ -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!()
|
||||
|
||||
Reference in New Issue
Block a user