mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
Utilities/sed: Add tests for the transform command & comments
This commit is contained in:
parent
ef6f3db1ca
commit
46522b2efa
1 changed files with 14 additions and 0 deletions
|
@ -25,6 +25,20 @@ static void run_sed(Vector<char const*>&& arguments, StringView standard_input,
|
|||
EXPECT_EQ(StringView { expected_stdout.bytes() }, StringView { stdout.bytes() });
|
||||
}
|
||||
|
||||
TEST_CASE(transform_command)
|
||||
{
|
||||
run_sed({ "y/fb/FB/" }, "foobar\n"sv, "FooBar\n"sv);
|
||||
run_sed({ "y;fb;FB;" }, "foobar\n"sv, "FooBar\n"sv);
|
||||
run_sed({ "y///" }, "foobar\n"sv, "foobar\n"sv);
|
||||
run_sed({ "y/abcdefghijklmnopqrstuvwxyz/defghijklmnopqrstuvwxyzabc/" }, "attack at dawn\n"sv, "dwwdfn dw gdzq\n"sv);
|
||||
}
|
||||
|
||||
TEST_CASE(comments)
|
||||
{
|
||||
run_sed({ "# This is a comment! " }, "foo\nbar\nbaz\n"sv, "foo\nbar\nbaz\n"sv);
|
||||
run_sed({ "# This is a comment!\np" }, "foo\nbar\nbaz\n"sv, "foo\nfoo\nbar\nbar\nbaz\nbaz\n"sv);
|
||||
}
|
||||
|
||||
TEST_CASE(quit_after_single_line)
|
||||
{
|
||||
run_sed({ "q" }, "foo\n"sv, "foo\n"sv);
|
||||
|
|
Loading…
Reference in a new issue