Skip to content

Commit

Permalink
Chipping away at the barfly
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Feb 6, 2025
1 parent a678e32 commit b2ec90a
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 206 deletions.
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ t/ack-underline.barfly
t/ack-underline.t
t/ack-v.yaml
t/ack-version.t
t/ack-w.barfly
t/ack-w.t
t/ack-w.yaml
t/ack-x.t
t/anchored.t
t/bad-ackrc-opt.t
Expand Down
200 changes: 0 additions & 200 deletions t/ack-w.barfly

This file was deleted.

5 changes: 1 addition & 4 deletions t/ack-w.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
use warnings;
use strict;

use Test::More tests => 15;
use Test::More tests => 8;

use lib 't';
use Util;
use Barfly;

prep_environment();

my $ACK = $ENV{ACK_TEST_STANDALONE} ? 'ack-standalone' : 'ack';

Barfly->run_tests( 't/ack-w.barfly' );

subtest '-w with trailing metachar \w' => sub {
plan tests => 1;

Expand Down
130 changes: 130 additions & 0 deletions t/ack-w.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
name: Straight -w
args: -w foo
ordered: true
stdin: |
foo
foo bar
foobar
foot
underfoot
football
foo-foo football
End of the line foo
I pity da foo'.
stdout: |
foo
foo bar
foo-foo football
End of the line foo
I pity da foo'.
---
name: -w and optional character
args:
- -w foot?
- -w (foot?)
- "-w (?:foot?)"
ordered: true
stdin: |
foo
foot
Trampled underfoot
foobarf
foo-bar
foo-bart
Our ten-foot foo-bird is foobar.
football
stdout: |
foo
foot
foo-bar
foo-bart
Our ten-foot foo-bird is foobar.
---
name: -w and optional character, highlighting
args: -w foot? --underline
ordered: true
stdin: |
Trampled underfoot
foobarf
Our ten-foot foo-bird is foobar.
football
stdout: |
Our ten-foot foo-bird is foobar.
^^^^ ^^^
---
name: -w and optional group
args:
- -w foo(bar)?
ordered: true
stdin: |
foo
foobar
foo-bar
foo-bart
Trampled underfoot
foobarf
stdout: |
foo
foobar
foo-bar
foo-bart
---
name: -w and alternation
args:
- -w foo|bar
- -w (foo|bar)
ordered: true
stdin: |
bar
barfly
barometric
foo
fubar
schmfoo
schmofool
subarometric
stdout: |
bar
foo
---
name: -w and function definition
args:
- -w (set|get)_user_(name|perm)
- -w ((set|get)_user_(name|perm))
- "-w (?:(?:set|get)_user_(?:name|perm))"
- "-w (?:(set|get)_user_(name|perm))"
- "-w ((?:set|get)_user_(?:name|perm))"
ordered: true
stdin: |
get_user_perm
get_user_permission
reset_user_name
set_user_name
stdout: |
get_user_perm
set_user_name
---
name: Single-letter words
args:
- -w \w
ordered: true
stdin: |
A
b
c
!E!
NO
dd
xxx
stdout: |
A
b
c
!E!
2 changes: 1 addition & 1 deletion t/yaml.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use warnings;
use strict;

use Test::More tests => 16;
use Test::More tests => 17;

use lib 't';
use Util;
Expand Down

0 comments on commit b2ec90a

Please sign in to comment.