From c21eb19c5940de04db7c0bc52054d2463670f912 Mon Sep 17 00:00:00 2001 From: Andy Lester Date: Mon, 20 Jan 2025 15:52:51 -0600 Subject: [PATCH] Got -o going in YAML --- MANIFEST | 2 +- t/ack-o.t | 51 --------------------------------------------------- t/ack-o.yaml | 25 +++++++++++++++++++++++++ t/run_test.py | 2 -- 4 files changed, 26 insertions(+), 54 deletions(-) delete mode 100644 t/ack-o.t create mode 100644 t/ack-o.yaml diff --git a/MANIFEST b/MANIFEST index d4e4ade1..fe760a43 100644 --- a/MANIFEST +++ b/MANIFEST @@ -57,7 +57,7 @@ t/ack-m.t t/ack-man.t t/ack-match.t t/ack-n.t -t/ack-o.t +t/ack-o.yaml t/ack-output.t t/ack-pager.t t/ack-passthru.t diff --git a/t/ack-o.t b/t/ack-o.t deleted file mode 100644 index 0d1adf34..00000000 --- a/t/ack-o.t +++ /dev/null @@ -1,51 +0,0 @@ -#!perl - -use warnings; -use strict; - -use Test::More tests => 2; - -use lib 't'; -use Util; - -prep_environment(); - -NO_O: { - my @files = qw( t/text/gettysburg.txt ); - my @args = qw( the\\s+\\S+ ); - my @expected = line_split( <<'HERE' ); - but it can never forget what they did here. It is for us the living, - rather, to be dedicated here to the unfinished work which they who - here dedicated to the great task remaining before us -- that from these - the last full measure of devotion -- that we here highly resolve that - shall have a new birth of freedom -- and that government of the people, - by the people, for the people, shall not perish from the earth. -HERE - s/^\s+// for @expected; - - ack_lists_match( [ @args, @files ], \@expected, 'Find all the things without -o' ); -} - - -WITH_O: { - my @files = qw( t/text/gettysburg.txt ); - my @args = qw( the\\s+\\S+ -o ); - my @expected = line_split( <<'HERE' ); - the living, - the unfinished - the great - the last - the people, - the people, - the people, - the earth. -HERE - s/^\s+// for @expected; - - ack_lists_match( [ @args, @files ], \@expected, 'Find all the things with -o' ); -} - - -done_testing(); - -exit 0; diff --git a/t/ack-o.yaml b/t/ack-o.yaml new file mode 100644 index 00000000..f26b56a9 --- /dev/null +++ b/t/ack-o.yaml @@ -0,0 +1,25 @@ +--- +name: No -o +args: 'the\s+\S+ t/text/gettysburg.txt' +ordered: true +stdout: | + but it can never forget what they did here. It is for us the living, + rather, to be dedicated here to the unfinished work which they who + here dedicated to the great task remaining before us -- that from these + the last full measure of devotion -- that we here highly resolve that + shall have a new birth of freedom -- and that government of the people, + by the people, for the people, shall not perish from the earth. + +--- +name: With -o +args: 'the\s+\S+ t/text/gettysburg.txt -o' +ordered: true +stdout: | + the living, + the unfinished + the great + the last + the people, + the people, + the people, + the earth. diff --git a/t/run_test.py b/t/run_test.py index 0bcbf083..776d594f 100644 --- a/t/run_test.py +++ b/t/run_test.py @@ -32,8 +32,6 @@ def sorted_output(block: str): def run_test(test): - print(test) - for args in test["args"]: args = args.split() command = ["perl", "-Mblib", "ack", "--noenv"] + args