2022-10-26 19:31:39 +00:00
|
|
|
use expect_test::{expect, Expect};
|
|
|
|
use oyster_parser::ast;
|
2022-07-14 22:26:57 +00:00
|
|
|
|
2022-10-26 19:31:39 +00:00
|
|
|
fn check(s: &str, expect: Expect) {
|
|
|
|
let actual = ast::Code::try_from(s);
|
|
|
|
expect.assert_debug_eq(&actual);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn empty() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"",
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn word() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"word",
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"word",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn word_with_escape() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
r"hello\#world",
|
|
|
|
expect![[r##"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"hello",
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"#",
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"world",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"##]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn unicode() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"谚语",
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"谚语",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn simple_command() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"echo hi",
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"echo",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"hi",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn semicolon() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"hello; hi",
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"hello",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"hi",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn comment() {
|
|
|
|
let source = r"# a
|
|
|
|
# b";
|
|
|
|
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
source,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn inline_comment() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"whoami # hello",
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"whoami",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn pipeline() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"whoami | cat",
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"whoami",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
Stdout,
|
|
|
|
),
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"cat",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn multiline_pipeline() {
|
|
|
|
let source = r"whoami |
|
|
|
|
wc -l";
|
|
|
|
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
source,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"whoami",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
Stdout,
|
|
|
|
),
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"wc",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"-l",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn comment_in_pipeline() {
|
|
|
|
let source = r"whoami | # comment
|
|
|
|
wc -l";
|
|
|
|
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
source,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"whoami",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
Stdout,
|
|
|
|
),
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"wc",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"-l",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn reject_leading_pipe() {
|
|
|
|
let source = r"whoami
|
|
|
|
| cat";
|
|
|
|
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
source,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Err(
|
|
|
|
UnexpectedPipe,
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn reject_trailing_pipe() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"whoami |",
|
|
|
|
expect![[r#"
|
|
|
|
Err(
|
|
|
|
UnexpectedEof,
|
|
|
|
)
|
|
|
|
"#]],
|
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn reject_pipe_semicolon() {
|
|
|
|
let source = "whoami | ; cat";
|
|
|
|
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
source,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Err(
|
|
|
|
UnexpectedSemicolon,
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn reject_double_pipe() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
"whoami | | cat",
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Err(
|
|
|
|
UnexpectedPipe,
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-07-14 22:26:57 +00:00
|
|
|
}
|
2022-09-24 17:17:56 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn double_quote_string() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
r#""hello world""#,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"hello world",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-09-24 17:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn escaped_char_in_double_quotes() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
r#""hello \" world""#,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"hello ",
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"\"",
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
" world",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-09-24 17:17:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn unterminated_double_quotes() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
r#""hello world"#,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Err(
|
|
|
|
UnexpectedEof,
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-09-24 17:17:56 +00:00
|
|
|
}
|
2022-10-24 19:27:04 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn command_substitution() {
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
r#"echo (whoami)"#,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"echo",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
CommandSubstitution(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"whoami",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-10-24 19:27:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn quoted_command_substitution() {
|
|
|
|
let source = r#"echo "(whoami)
|
|
|
|
""#;
|
|
|
|
|
2022-10-26 19:31:39 +00:00
|
|
|
check(
|
|
|
|
source,
|
|
|
|
expect![[r#"
|
2022-11-05 13:32:38 +00:00
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"echo",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
CommandSubstitution(
|
|
|
|
Code(
|
|
|
|
[
|
2022-10-26 19:31:39 +00:00
|
|
|
Pipeline(
|
2022-11-05 13:32:38 +00:00
|
|
|
Pipeline(
|
|
|
|
[
|
|
|
|
Command(
|
|
|
|
[
|
|
|
|
Word(
|
|
|
|
[
|
|
|
|
Text(
|
|
|
|
"whoami",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"\n ",
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
None,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-10-26 19:31:39 +00:00
|
|
|
),
|
2022-11-05 13:32:38 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
2022-10-26 19:31:39 +00:00
|
|
|
);
|
2022-10-24 19:27:04 +00:00
|
|
|
}
|
2022-11-07 13:41:28 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn empty_pipeline() {
|
|
|
|
check(
|
|
|
|
";",
|
|
|
|
expect![[r#"
|
|
|
|
Ok(
|
|
|
|
Code(
|
|
|
|
[],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
"#]],
|
|
|
|
);
|
|
|
|
}
|