54 | # Weird combinations
55 | \A\B\S{14}\G\Dfoo\W*\S+\Z
56 | END
57 |
58 |
59 | my $uc_list = <<'END';
60 | This is \\Here.
61 | foo[A-Z]+
62 | [A-Z]*bar
63 | parens([A-Z]*)
64 | foo(?!lookahead)([A-Z]*)
65 |
66 | # Don't get confused by regex metacharacters.
67 | \WWhat now?
68 | dumb \DDonald
69 | lost in \SSpace
70 | lost in \\\\Diskland
71 |
72 | # Weird combinations
73 | \A\\\B\S{14}\G\\\D\\Dog\\\W*\\\\\S+\\\\\Z
74 | \\W//\\W//\\Larry//\\D//?
75 | END
76 |
77 |
78 | my @lc_list = _big_split($lc_list);
79 | if ( $] >= 5.012 ) {
80 | push( @lc_list, 'anything but \n -> \N' );
81 | }
82 |
83 | my @uc_list = _big_split($uc_list);
84 |
85 | subtest 'Check lowercase' => sub {
86 | plan tests => scalar @lc_list;
87 |
88 | for my $lc ( @lc_list ) {
89 | my $re = qr/$lc/;
90 | ok( App::Ack::is_lowercase( $lc ), qq{"$lc" should be lowercase} );
91 | }
92 | };
93 |
94 | subtest 'Check uppercase' => sub {
95 | plan tests => scalar @uc_list;
96 |
97 | for my $uc ( @uc_list ) {
98 | my $re = qr/$uc/;
99 | ok( !App::Ack::is_lowercase( $uc ), qq{"$uc" should not be lowercase} );
100 | }
101 | };
102 |
103 | done_testing();
104 | exit 0;
105 |
106 |
107 | sub _big_split {
108 | my $str = shift;
109 |
110 | return grep { /./ && !/^#/ } split( /\n/, $str );
111 | }
112 |
--------------------------------------------------------------------------------
/t/match-filter.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use strict;
4 | use warnings;
5 | use lib 't';
6 |
7 | use FilterTest;
8 | use Test::More tests => 1;
9 |
10 | use App::Ack::Filter::Match;
11 |
12 | filter_test(
13 | [ match => '/^.akefile/' ], [
14 | 't/swamp/Makefile',
15 | 't/swamp/Makefile.PL',
16 | 't/swamp/Rakefile',
17 | ], 'only files matching /^.akefile/ should be matched',
18 | );
19 |
--------------------------------------------------------------------------------
/t/multiple-captures.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | # Multiple capture groups used to confuse ack.
4 | # https://github.com/beyondgrep/ack2/issues/244
5 |
6 | use strict;
7 | use warnings;
8 | use Test::More;
9 |
10 | use lib 't';
11 | use Util;
12 |
13 | plan tests => 2;
14 |
15 | prep_environment();
16 |
17 | my ( $stdout, $stderr ) = run_ack_with_stderr('--color', '(foo)|(bar)', 't/swamp');
18 | is_nonempty_array( $stdout );
19 | is_empty_array( $stderr );
20 |
21 | exit 0;
22 |
--------------------------------------------------------------------------------
/t/mutex.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | # Order doesn't matter. They are reported in alphabetical order.
3 | name: -f and -g
4 | args:
5 | - -f -g WORD
6 | - -g WORD -f
7 | exitcode: 255
8 | stdout:
9 | stderr: |
10 | ack: Options '-f' and '-g' can't be used together.
11 |
12 | ---
13 | name: -f and -p
14 | args:
15 | - -f -p
16 | - -f -p 2
17 | exitcode: 255
18 | stdout:
19 | stderr: |
20 | ack: Options '-f' and '-p' can't be used together.
21 |
22 | ---
23 | name: -f and --proximate
24 | args:
25 | - -f --proximate
26 | - -f --proximate 2
27 | exitcode: 255
28 | stdout:
29 | stderr: |
30 | ack: Options '-f' and '--proximate' can't be used together.
31 |
32 | ---
33 | # Check for abbreviations. https://github.com/beyondgrep/ack3/issues/57
34 | name: -f and --proximate abbreviations
35 | args:
36 | - -f --pro
37 | - -f --prox
38 | - -f --proxi
39 | - -f --proxim
40 | - -f --proxima
41 | - -f --proximat
42 | - -f --proximate
43 | exitcode: 255
44 | stdout:
45 | stderr: |
46 | ack: Options '-f' and '--proximate' can't be used together.
47 |
48 | ---
49 | name: -f and --match
50 | args:
51 | - -f --match WORD
52 | exitcode: 255
53 | stdout:
54 | stderr: |
55 | ack: Options '-f' and '--match' can't be used together.
56 |
57 | ---
58 | name: -g and --match
59 | args:
60 | - -g WORD --match WORD
61 | exitcode: 255
62 | stdout:
63 | stderr: |
64 | ack: Options '-g' and '--match' can't be used together.
65 |
66 | ---
67 | name: --or and --and
68 | args:
69 | - this --or that --and other
70 | exitcode: 255
71 | stdout:
72 | stderr: |
73 | ack: Options '--and' and '--or' can't be used together.
74 |
--------------------------------------------------------------------------------
/t/named-pipes.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use strict;
4 | use warnings;
5 | use lib 't';
6 |
7 | use File::Temp;
8 | use Test::More;
9 | use Util;
10 | use POSIX ();
11 |
12 | MAIN: {
13 | local $SIG{'ALRM'} = sub {
14 | fail 'Timeout';
15 | exit;
16 | };
17 |
18 | prep_environment();
19 |
20 | my $tempdir = File::Temp->newdir;
21 | safe_mkdir( "$tempdir/foo" );
22 | my $rc = eval { POSIX::mkfifo( "$tempdir/foo/test.pipe", oct(660) ) };
23 | if ( !$rc ) {
24 | dir_cleanup( $tempdir );
25 | plan skip_all => $@ ? $@ : q{I can't run a mkfifo, so cannot run this test.};
26 | }
27 |
28 | plan tests => 2;
29 |
30 | touch( "$tempdir/foo/bar.txt" );
31 |
32 | alarm 5; # Should be plenty of time.
33 |
34 | my @results = run_ack( '-f', $tempdir );
35 |
36 | is_deeply( \@results, [
37 | "$tempdir/foo/bar.txt",
38 | ], 'Acking should not find the fifo' );
39 |
40 | dir_cleanup( $tempdir );
41 |
42 | done_testing();
43 | }
44 |
45 | exit 0;
46 |
47 | sub dir_cleanup {
48 | my $tempdir = shift;
49 |
50 | unlink "$tempdir/foo/bar.txt";
51 | rmdir "$tempdir/foo";
52 | rmdir $tempdir;
53 |
54 | return;
55 | }
56 |
--------------------------------------------------------------------------------
/t/needs-line-scan.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 |
6 | use Test::More tests => 1;
7 |
8 | use lib 't';
9 | use Util;
10 |
11 | prep_environment();
12 |
13 | # The "bongo" match is after the 100,000-byte cutoff.
14 | NEEDS_LINE_SCAN: {
15 | my @expected = line_split( <<'HERE' );
16 | my $bongo = 'yada yada';
17 | HERE
18 |
19 | my @files = qw( t/swamp );
20 | my @args = qw( bongo -w -h );
21 |
22 | ack_lists_match( [ @args, @files ], \@expected, 'Looking for Lenore!' );
23 | }
24 |
25 | exit 0;
26 |
--------------------------------------------------------------------------------
/t/noackrc.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use strict;
4 | use warnings;
5 | use lib 't';
6 |
7 | use Test::More tests => 1;
8 | use Util;
9 |
10 | prep_environment();
11 |
12 | my @expected = (
13 | 't/swamp/Makefile.PL',
14 | 't/swamp/constitution-100k.pl',
15 | 't/swamp/options-crlf.pl',
16 | 't/swamp/options.pl',
17 | 't/swamp/perl.pl',
18 | );
19 |
20 | my @args = ( '--ignore-ack-defaults', '--type-add=perl:ext:pl', '-t', 'perl', '-f' );
21 | my @files = ( 't/swamp' );
22 |
23 | ack_sets_match( [ @args, @files ], \@expected, __FILE__ );
24 |
25 | done_testing();
26 |
--------------------------------------------------------------------------------
/t/noenv.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use Test::More tests => 3;
7 |
8 | use lib 't';
9 | use Util;
10 |
11 | use App::Ack::ConfigLoader;
12 | use Cwd qw( realpath );
13 | use File::Spec ();
14 | use File::Temp ();
15 |
16 | sub is_global_file {
17 | my ( $filename ) = @_;
18 |
19 | return unless -f $filename;
20 |
21 | my ( undef, $dir ) = File::Spec->splitpath($filename);
22 | $dir = File::Spec->canonpath($dir);
23 |
24 | my (undef, $wd) = File::Spec->splitpath(getcwd_clean(), 1);
25 | $wd = File::Spec->canonpath($wd);
26 |
27 | return $wd !~ /^\Q$dir\E/;
28 | }
29 |
30 | sub remove_defaults_and_globals {
31 | my ( @sources ) = @_;
32 |
33 | return grep {
34 | $_->{name} ne 'Defaults' && !is_global_file($_->{name})
35 | } @sources;
36 | }
37 |
38 | prep_environment();
39 |
40 | my $wd = getcwd_clean() or die;
41 |
42 | my $tempdir = File::Temp->newdir;
43 |
44 | safe_chdir( $tempdir->dirname );
45 |
46 | write_file( '.ackrc', <<'ACKRC' );
47 | --type-add=perl:ext:pl,t,pm
48 | ACKRC
49 |
50 | subtest 'without --noenv' => sub {
51 | plan tests => 1;
52 |
53 | local @ARGV = ('-f', 'lib/');
54 |
55 | my @sources = App::Ack::ConfigLoader::retrieve_arg_sources();
56 | @sources = remove_defaults_and_globals(@sources);
57 |
58 | is_deeply( \@sources, [
59 | {
60 | name => File::Spec->canonpath(realpath(File::Spec->catfile($tempdir->dirname, '.ackrc'))),
61 | contents => [ '--type-add=perl:ext:pl,t,pm' ],
62 | project => 1,
63 | is_ackrc => 1,
64 | },
65 | {
66 | name => 'ARGV',
67 | contents => ['-f', 'lib/'],
68 | },
69 | ], 'Get back a long list of arguments' );
70 | };
71 |
72 | subtest 'with --noenv' => sub {
73 | plan tests => 1;
74 |
75 | local @ARGV = ('--noenv', '-f', 'lib/');
76 |
77 | my @sources = App::Ack::ConfigLoader::retrieve_arg_sources();
78 | @sources = remove_defaults_and_globals(@sources);
79 |
80 | is_deeply( \@sources, [
81 | {
82 | name => 'ARGV',
83 | contents => ['-f', 'lib/'],
84 | },
85 | ], 'Short list comes back because of --noenv' );
86 | };
87 |
88 | subtest '--noenv in config' => sub {
89 | plan tests => 3;
90 |
91 | append_file( '.ackrc', "--noenv\n" );
92 |
93 | my ( $stdout, $stderr ) = run_ack_with_stderr('--env', 'perl');
94 | is_empty_array( $stdout );
95 | is( @{$stderr}, 1 );
96 | like( $stderr->[0], qr/--noenv found in (?:.*)[.]ackrc/ ) or diag(explain($stderr));
97 | };
98 |
99 | safe_chdir( $wd ); # Go back to the original directory to avoid warnings
100 |
--------------------------------------------------------------------------------
/t/prescan-line-boundaries.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | # https://github.com/beyondgrep/ack2/issues/571
4 |
5 | use strict;
6 | use warnings;
7 | use lib 't';
8 |
9 | use Test::More tests => 2;
10 | use Util;
11 |
12 | prep_environment();
13 |
14 | my $tempfile = create_tempfile( <<'HERE' );
15 | fo
16 |
17 | oo
18 | HERE
19 |
20 | my @results = run_ack('-l', 'fo\s+oo', $tempfile->filename);
21 | is_empty_array( \@results, '\s+ should never match across line boundaries' );
22 |
--------------------------------------------------------------------------------
/t/process-substitution.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use strict;
4 | use warnings;
5 | use lib 't';
6 |
7 | use Test::More;
8 | use Util;
9 |
10 | my @expected = (
11 | 'THIS IS ALL IN UPPER CASE',
12 | 'this is a word here',
13 | );
14 |
15 | prep_environment();
16 |
17 | if ( is_windows() ) {
18 | plan skip_all => 'Test unreliable on Windows.';
19 | }
20 |
21 | system 'bash', '-c', 'exit';
22 | if ( $? ) {
23 | plan skip_all => 'You need bash to run this test';
24 | exit;
25 | }
26 |
27 | plan tests => 1;
28 |
29 | my ( $read, $write );
30 |
31 | pipe( $read, $write );
32 |
33 | my $pid = fork();
34 |
35 | my @output;
36 |
37 | if ( $pid ) {
38 | close $write;
39 | while ( <$read> ) {
40 | chomp;
41 | push @output, $_;
42 | }
43 | waitpid $pid, 0;
44 | }
45 | else {
46 | close $read;
47 | open STDOUT, '>&', $write or die "Can't open: $!";
48 | open STDERR, '>&', $write or die "Can't open: $!";
49 |
50 | my @args = adjust_executable( build_ack_invocation( qw( --noenv --nocolor --smart-case this ) ) );
51 | my $args = join( ' ', @args );
52 | exec 'bash', '-c', "$args <(cat t/swamp/options.pl)";
53 | }
54 |
55 | lists_match( \@output, \@expected, __FILE__ );
56 |
57 | exit 0;
58 |
--------------------------------------------------------------------------------
/t/range/america-the-beautiful.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | America the Beautiful
5 |
6 |
7 | America the Beautiful
8 |
9 |
10 | O beautiful for spacious skies,
11 | For amber waves of grain,
12 | For purple mountain majesties
13 | Above the fruited plain!
14 | America! America!
15 | God shed His grace on thee
16 | And crown thy good with brotherhood
17 | From sea to shining sea!
18 |
19 |
20 |
21 | O beautiful for pilgrim feet,
22 | Whose stern, impassioned stress
23 | A thoroughfare for freedom beat
24 | Across the wilderness!
25 | America! America!
26 | God mend thine every flaw,
27 | Confirm thy soul in self-control,
28 | Thy liberty in law!
29 |
30 |
31 |
32 | O beautiful for heroes proved
33 | In liberating strife,
34 | Who more than self their country loved
35 | And mercy more than life!
36 | America! America!
37 | May God thy gold refine,
38 | Till all success be nobleness,
39 | And every gain divine!
40 |
41 |
42 |
43 | O beautiful for patriot dream
44 | That sees beyond the years
45 | Thine alabaster cities gleam
46 | Undimmed by human tears!
47 | America! America!
48 | God shed His grace on thee
49 | And crown thy good with brotherhood
50 | From sea to shining sea!
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/t/range/anchors-aweigh.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Anchors Aweigh>
5 |
6 |
7 | Anchors Aweigh
8 |
9 |
10 | Stand Navy out to sea, fight our battle cry!
11 | We'll never change our course so vicious foes steer shy-y-y-y!
12 | Roll out the TNT, anchors aweigh!
13 | Sail on to victory, and sink their bones to Davy Jones, hooray!
14 |
15 |
16 |
17 | Anchors Aweigh, my boys, Anchors Aweigh!
18 | Farewell to foreign Shores, we sail at break of day-ay-ay-ay;
19 | Through our last night ashore, drink to the foam,
20 | Until we meet once more, here's wishing you a happy voyage home!
21 |
22 |
23 |
24 | Blue of the mighty deep, Gold of God's great sun;
25 | Let these our colors be, Till All of time be done-n-n-ne;
26 | On seven seas we learn, Navy's stern call:
27 | Faith, courage, service true, With honor over, honor over all.
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/t/range/johnny-rebeck.txt:
--------------------------------------------------------------------------------
1 | VERSE
2 | There once was a little Dutchman
3 | His name was Johnny Rebeck
4 | He was a dealer in sauerkraut
5 | And sausages and speck
6 | He was the finest Dutchman
7 | The best you've ever seen
8 | 'til one day he invented
9 | A great big sausage machine
10 | Bang!
11 |
12 | CHORUS
13 | Oh, Mr. Johnny Rebeck what makes you be so mean?
14 | I told you you'd be sorry for inventing that machine
15 | Now all the neighbors' cats and dogs will nevermore be seen
16 | They'll all be ground to sausages in Johnny Rebeck's machine.
17 | Bang!
18 |
19 | VERSE
20 | One night the darn thing busted
21 | The darn thing wouldn't go
22 | So Johnny Rebeck crawled inside
23 | To see what made it so
24 | That night his wife had a nightmare
25 | And walking in her sleep
26 | She turned the crank
27 | And gave it a yank
28 | Pooooor Johnny Rebeck was meat
29 | Bang!
30 |
--------------------------------------------------------------------------------
/t/range/rangefile.pm:
--------------------------------------------------------------------------------
1 | package RangeFile;
2 |
3 | # For testing the range function.
4 |
5 | use warnings;
6 | use strict;
7 | use 5.010;
8 |
9 | # This function calls print on "foo".
10 | sub foo {
11 | print 'foo';
12 | return 1;
13 | }
14 |
15 | my $print = 1;
16 | my $update = 5;
17 |
18 | sub bar {
19 | print 'bar';
20 | return 2;
21 | }
22 | my $task = 'print';
23 | $update = 12;
24 |
25 | 1;
26 |
--------------------------------------------------------------------------------
/t/range/stars-and-stripes-forever.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The Stars and Stripes Forever
5 |
6 |
7 | The Stars and Stripes Forever
8 |
9 | By John Philip Sousa
10 |
11 |
12 | Let martial note in triumph float
13 | And liberty extend its mighty hand
14 | A flag appears 'mid thunderous cheers,
15 | The banner of the Western land.
16 | The emblem of the brave and true
17 | Its folds protect no tyrant crew;
18 | The red and white and starry blue
19 | Is freedom's shield and hope.
20 |
21 | Let eagle shriek from lofty peak
22 | The never-ending watchword of our land;
23 | Let summer breeze waft through the trees
24 | The echo of the chorus grand.
25 | Sing out for liberty and light,
26 | Sing out for freedom and the right.
27 | Sing out for Union and its might,
28 | O patriotic sons.
29 |
30 |
31 |
32 | Other nations may deem their flags the best
33 | And cheer them with fervid elation
34 | But the flag of the North and South and West
35 | Is the flag of flags, the flag of Freedom's nation.
36 |
37 |
38 |
39 | Hurrah for the flag of the free!
40 | May it wave as our standard forever,
41 | The gem of the land and the sea,
42 | The banner of the right.
43 | Let despots remember the day
44 | When our fathers with mighty endeavor
45 | Proclaimed as they marched to the fray
46 | That by their might and by their right
47 | It waves forever.
48 |
49 |
50 |
51 | Hurrah for the flag of the free.
52 | May it wave as our standard forever
53 | The gem of the land and the sea,
54 | The banner of the right.
55 | Let despots remember the day
56 | When our fathers with mighty endeavor
57 | Proclaimed as they marched to the fray,
58 | That by their might and by their right
59 | It waves forever.
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/t/run_yaml_test.py:
--------------------------------------------------------------------------------
1 | import difflib
2 | import glob
3 | import logging
4 | import os
5 | import subprocess
6 | import sys
7 |
8 |
9 | try:
10 | import yaml
11 | except ImportError:
12 | print('Unable to import yaml module')
13 | sys.exit(1)
14 |
15 |
16 | logger = logging.getLogger(__name__)
17 |
18 |
19 | def test_all_yaml_files():
20 | """
21 | Walk all the YAML files and run their tests.
22 | """
23 | filenames = sorted(glob.glob('t/*.yaml'))
24 | for filename in filenames:
25 | skipped_ack3_only = 0
26 | logger.info(f'YAML: {filename}')
27 | with open(filename, 'r', encoding='UTF-8') as f:
28 | cases = yaml.load_all(f, yaml.FullLoader)
29 | for case in cases:
30 | case = massage_case(case)
31 | if case.get('ack3-only', False):
32 | skipped_ack3_only += 1
33 | else:
34 | run_case(case)
35 | if skipped_ack3_only:
36 | logger.info(f' Skipped {skipped_ack3_only} ack3-only case(s)')
37 |
38 |
39 |
40 | def massage_case(case: dict):
41 | """
42 | Takes the raw case from the YAML and sets defaults.
43 | """
44 | if 'exitcode' not in case:
45 | case['exitcode'] = 0
46 |
47 | # Make an array of args arrays out of it if it's not already.
48 | if not isinstance(case['args'], list):
49 | case['args'] = [case['args']]
50 |
51 | if case['stdout'] is None:
52 | case['stdout'] = ''
53 |
54 | return case
55 |
56 |
57 | def expected_lines(case):
58 | """
59 | Gets the lines expected from the case, adjusting on the settings.
60 | """
61 | lines = case['stdout'].splitlines()
62 | if indent := case.get('indent-stdout', 0):
63 | lines = [' ' * indent + x for x in lines]
64 |
65 | return lines
66 |
67 |
68 | def show_diff(exp, got):
69 | """
70 | Shows the diffs between two sets of strings
71 | """
72 | diff = '\n'.join(
73 | difflib.unified_diff(
74 | exp, got, fromfile='expected', tofile='got', lineterm=''
75 | )
76 | )
77 | print(diff)
78 |
79 |
80 | def run_case(case):
81 | """
82 | Runs an individual case from the YAML.
83 | """
84 | logger.info(' Case: %s' % case['name'])
85 | for args in case['args']:
86 | if os.getenv('DIRK'):
87 | command = ['./dirk', '--nocolor']
88 | else:
89 | command = ['perl', '-Mblib', 'ack', '--noenv']
90 | command += args.split()
91 | logger.info(' Command: %s' % ' '.join(command))
92 |
93 | try:
94 | result = subprocess.run(
95 | command,
96 | input=case.get('stdin', None),
97 | capture_output=True,
98 | text=True,
99 | check=(not case['exitcode']),
100 | )
101 | except subprocess.CalledProcessError as e:
102 | print('STDOUT from', command)
103 | print(repr(e.stdout))
104 | print('STDERR from', command)
105 | print(repr(e.stderr))
106 | raise
107 |
108 | if case['exitcode']:
109 | assert result.returncode == case['exitcode']
110 |
111 | exp_lines = expected_lines(case)
112 | got_lines = result.stdout.splitlines()
113 | if not case.get('ordered', False):
114 | got_lines = sorted(got_lines)
115 | exp_lines = sorted(exp_lines)
116 |
117 | # show_diff(exp_lines, got_lines)
118 | assert got_lines == exp_lines
119 |
120 |
121 | test_all_yaml_files()
122 |
--------------------------------------------------------------------------------
/t/runtests.pl:
--------------------------------------------------------------------------------
1 | #! /usr/bin/perl
2 | #---------------------------------------------------------------------
3 | # Run tests for ack
4 | #
5 | # Windows makes it hard to temporarily set environment variables, and
6 | # has horrible quoting rules, so what should be a one-liner gets its
7 | # own script.
8 | #---------------------------------------------------------------------
9 |
10 | use ExtUtils::Command::MM;
11 |
12 | $ENV{PERL_DL_NONLAZY} = 1;
13 | $ENV{ACK_TEST_STANDALONE} = shift;
14 |
15 | defined($ENV{ACK_TEST_STANDALONE}) or die 'Must pass an argument to set ACK_TEST_STANDALONE';
16 |
17 | # Make sure the tests' standard input is *never* a pipe (messes with ack's filter detection).
18 | open STDIN, '<', '/dev/null';
19 |
20 | printf(
21 | "Running tests on %s, ACK_TEST_STANDALONE=%s\n",
22 | $ENV{ACK_TEST_STANDALONE} ? 'ack-standalone' : 'blib/script/ack',
23 | $ENV{ACK_TEST_STANDALONE}
24 | );
25 | test_harness(shift, shift, shift);
26 |
--------------------------------------------------------------------------------
/t/swamp/#emacs-workfile.pl#:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | ## no critic
3 |
4 | This is a scratch emacs workfile that has a shebang line but should not get read.
5 |
--------------------------------------------------------------------------------
/t/swamp/0:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -w
2 |
3 | print "Every Perl programmer knows that 0 evaluates to false, and that it is a recipe for DANGER!\n";
4 |
--------------------------------------------------------------------------------
/t/swamp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Not actually a cmake file!
2 |
--------------------------------------------------------------------------------
/t/swamp/Makefile:
--------------------------------------------------------------------------------
1 | # This Makefile is for the ack extension to perl.
2 | #
3 | # It was generated automatically by MakeMaker version
4 | # 6.30 (Revision: Revision: 4535 ) from the contents of
5 | # Makefile.PL. Don't edit this file, edit Makefile.PL instead.
6 | #
7 | # ANY CHANGES MADE HERE WILL BE LOST!
8 | #
9 | # MakeMaker ARGV: ()
10 | #
11 | # MakeMaker Parameters:
12 |
13 | # ABSTRACT => q[A grep-like program specifically for large source trees]
14 | # AUTHOR => q[Andy Lester ]
15 | # EXE_FILES => [q[ack]]
16 | # MAN3PODS => { }
17 | # NAME => q[ack]
18 | # PM => { Ack.pm=>q[$(INST_LIBDIR)/App/Ack.pm] }
19 | # PREREQ_PM => { Test::More=>q[0], Getopt::Long=>q[0], Term::ANSIColor=>q[0] }
20 | # VERSION_FROM => q[Ack.pm]
21 | # clean => { FILES=>q[ack-*] }
22 | # dist => { COMPRESS=>q[gzip -9f], SUFFIX=>q[gz] }
23 |
24 | There's not really anything here. It's just to have something that starts out like a makefile.
25 |
--------------------------------------------------------------------------------
/t/swamp/Makefile.PL:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 | use Test::More tests => 1;
6 |
7 | BEGIN {
8 | use_ok( 'App::Ack' );
9 | }
10 |
11 | diag( "Testing App::Ack $App::Ack::VERSION, Perl $], $^X" );
12 |
--------------------------------------------------------------------------------
/t/swamp/MasterPage.master:
--------------------------------------------------------------------------------
1 | <%@ Master AutoEventWireup="true" CodeFile="MasterPage.master.cs" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/t/swamp/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'hoe'
3 |
4 | def announce(msg='')
5 | STDERR.puts msg
6 | end
7 |
8 | PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
9 | PKG_NAME = 'mechanize'
10 | PKG_VERSION = '0.6.4' + PKG_BUILD
11 |
12 | Hoe.new(PKG_NAME, PKG_VERSION) do |p|
13 | p.rubyforge_name = PKG_NAME
14 | p.author = 'Aaron Patterson'
15 | p.email = 'aaronp@rubyforge.org'
16 | p.summary = "Mechanize provides automated web-browsing"
17 | p.description = p.paragraphs_of('README.txt', 3).join("\n\n")
18 | p.url = p.paragraphs_of('README.txt', 1).first.strip
19 | p.changes = p.paragraphs_of('CHANGELOG.txt', 0..2).join("\n\n")
20 | files =
21 | (p.test_globs + ['test/**/tc_*.rb',
22 | "test/htdocs/**/*.{html,jpg}",
23 | 'test/data/server.*']).map { |x|
24 | Dir.glob(x)
25 | }.flatten + ['test/data/htpasswd']
26 | p.extra_deps = ['hpricot']
27 | p.spec_extras = { :test_files => files }
28 | end
29 |
30 | task :update_version do
31 | announce "Updating Mechanize Version to #{PKG_VERSION}"
32 | File.open("lib/mechanize/mech_version.rb", "w") do |f|
33 | f.puts "module WWW"
34 | f.puts " class Mechanize"
35 | f.puts " Version = '#{PKG_VERSION}'"
36 | f.puts " end"
37 | f.puts "end"
38 | end
39 | sh 'svn commit -m"updating version" lib/mechanize/mech_version.rb'
40 | end
41 |
42 | desc "Tag code"
43 | Rake::Task.define_task("tag") do |p|
44 | baseurl = "svn+ssh://#{ENV['USER']}@rubyforge.org/var/svn/#{PKG_NAME}"
45 | sh "svn cp -m 'tagged #{ PKG_VERSION }' . #{ baseurl }/tags/REL-#{ PKG_VERSION }"
46 | end
47 |
48 | desc "Branch code"
49 | Rake::Task.define_task("branch") do |p|
50 | baseurl = "svn+ssh://#{ENV['USER']}@rubyforge.org/var/svn/#{PKG_NAME}"
51 | sh "svn cp -m 'branched #{ PKG_VERSION }' #{baseurl}/trunk #{ baseurl }/branches/RB-#{ PKG_VERSION }"
52 | end
53 |
54 | desc "Update SSL Certificate"
55 | Rake::Task.define_task('ssl_cert') do |p|
56 | sh "openssl genrsa -des3 -out server.key 1024"
57 | sh "openssl req -new -key server.key -out server.csr"
58 | sh "cp server.key server.key.org"
59 | sh "openssl rsa -in server.key.org -out server.key"
60 | sh "openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt"
61 | sh "cp server.key server.pem"
62 | sh "mv server.key server.csr server.crt server.pem test/data/"
63 | sh "rm server.key.org"
64 | end
65 |
--------------------------------------------------------------------------------
/t/swamp/Sample.ascx:
--------------------------------------------------------------------------------
1 | <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Sample.ascx.cs" %>
2 |
3 | Sample Control!
4 |
--------------------------------------------------------------------------------
/t/swamp/Sample.asmx:
--------------------------------------------------------------------------------
1 | <%@ WebService Language="C#" Class="Sample" %>
2 |
3 | using System;
4 | using System.Web.Services;
5 |
6 | public class Sample : WebService {
7 | }
8 |
--------------------------------------------------------------------------------
/t/swamp/blib/ignore.pm:
--------------------------------------------------------------------------------
1 | #!perl -T
2 |
3 | use warnings;
4 | use strict;
5 | use Test::More tests => 1;
6 |
7 | BEGIN {
8 | use_ok( 'App::Ack' );
9 | }
10 |
11 | diag( "Testing App::Ack $App::Ack::VERSION, Perl $], $^X" );
12 |
--------------------------------------------------------------------------------
/t/swamp/blib/ignore.pod:
--------------------------------------------------------------------------------
1 | #!perl -T
2 |
3 | use warnings;
4 | use strict;
5 | use Test::More tests => 1;
6 |
7 | BEGIN {
8 | use_ok( 'App::Ack' );
9 | }
10 |
11 | diag( "Testing App::Ack $App::Ack::VERSION, Perl $], $^X" );
12 |
--------------------------------------------------------------------------------
/t/swamp/c-header.h:
--------------------------------------------------------------------------------
1 | /* perl.h
2 | *
3 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 | * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
5 | *
6 | * You may distribute under the terms of either the GNU General Public
7 | * License or the Artistic License, as specified in the README file.
8 | *
9 | */
10 |
11 | #ifndef H_PERL
12 | #define H_PERL 1
13 |
--------------------------------------------------------------------------------
/t/swamp/c-source.c:
--------------------------------------------------------------------------------
1 | /* A Bison parser, made from plural.y
2 | by GNU Bison version 1.28 */
3 |
4 | #define YYBISON 1 /* Identify Bison output. */
5 |
6 | /*
7 | Contains the
8 | magic string --noenv
9 | which can be tricky to find.
10 | */
11 |
12 | #define yyparse __gettextparse
13 | #define yylex __gettextlex
14 | #define yyerror __gettexterror
15 | #define yylval __gettextlval
16 | #define yychar __gettextchar
17 | #define yydebug __gettextdebug
18 | #define yynerrs __gettextnerrs
19 | #define EQUOP2 257
20 | #define CMPOP2 258
21 | #define ADDOP2 259
22 | #define MULOP2 260
23 | #define NUMBER 261
24 |
25 | #line 1 "plural.y"
26 |
27 | /* Expression parsing for plural form selection.
28 | Copyright (C) 2000, 2001 Free Software Foundation, Inc.
29 | Written by Ulrich Drepper , 2000.
30 |
31 | This program is free software; you can redistribute it and/or modify it
32 | under the terms of the GNU Library General Public License as published
33 | by the Free Software Foundation; either version 2, or (at your option)
34 | any later version.
35 |
36 | This program is distributed in the hope that it will be useful,
37 | but WITHOUT ANY WARRANTY; without even the implied warranty of
38 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
39 | Library General Public License for more details.
40 |
41 | You should have received a copy of the GNU Library General Public
42 | License along with this program; if not, write to the Free Software
43 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
44 | USA. */
45 |
46 | /* The bison generated parser uses alloca. AIX 3 forces us to put this
47 | declaration at the beginning of the file. The declaration in bison's
48 | skeleton file comes too late. This must come before
49 | because may include arbitrary system headers. */
50 | static void
51 | yyerror (str)
52 | const char *str;
53 | {
54 | /* Do nothing. We don't print error messages here. */
55 | }
56 |
--------------------------------------------------------------------------------
/t/swamp/crystallography-weenies.f:
--------------------------------------------------------------------------------
1 | PROGRAM FORMAT
2 | IMPLICIT NONE
3 | REAL :: X
4 | CHARACTER (LEN=11) :: FORM1
5 | CHARACTER (LEN=*), PARAMETER :: FORM2 = "( F12.3,A )"
6 | FORM1 = "( F12.3,A )"
7 | X = 12.0
8 | PRINT FORM1, X, ' HELLO '
9 | WRITE (*, FORM2) 2*X, ' HI '
10 | WRITE (*, "(F12.3,A )") 3*X, ' HI HI '
11 | END
12 |
--------------------------------------------------------------------------------
/t/swamp/example.R:
--------------------------------------------------------------------------------
1 | print('hi')
2 |
--------------------------------------------------------------------------------
/t/swamp/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyondgrep/ack3/b304dbee1cb4d125c6d44f191be8cd758c88acc3/t/swamp/favicon.ico
--------------------------------------------------------------------------------
/t/swamp/file.bar:
--------------------------------------------------------------------------------
1 | This is a bar file.
2 |
--------------------------------------------------------------------------------
/t/swamp/file.foo:
--------------------------------------------------------------------------------
1 | This is a foo file.
2 |
--------------------------------------------------------------------------------
/t/swamp/foo_test.py:
--------------------------------------------------------------------------------
1 | # foo_test.py IS a pytest test, as well as Python.
2 | # This test doesn't test anything meaningful. It's just here for filetype tests.
3 | # But it should pass.
4 |
5 | def test_reality():
6 | code = 1
7 | assert code == 1
8 |
--------------------------------------------------------------------------------
/t/swamp/fresh.css:
--------------------------------------------------------------------------------
1 | html,.wp-dialog{background-color:#fff;}* html input,* html .widget{border-color:#dfdfdf;}
2 |
--------------------------------------------------------------------------------
/t/swamp/fresh.css.min:
--------------------------------------------------------------------------------
1 | html,.wp-dialog{background-color:#fff;}* html input,* html .widget{border-color:#dfdfdf;}
2 |
--------------------------------------------------------------------------------
/t/swamp/fresh.min.css:
--------------------------------------------------------------------------------
1 | html,.wp-dialog{background-color:#fff;}* html input,* html .widget{border-color:#dfdfdf;}
2 |
--------------------------------------------------------------------------------
/t/swamp/groceries/CVS/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/CVS/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/CVS/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/RCS/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/RCS/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/RCS/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/CVS/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/CVS/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/CVS/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/RCS/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/RCS/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/RCS/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/another_subdir/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/CVS/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/CVS/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/CVS/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/RCS/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/RCS/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/RCS/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/dir.d/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/subdir/fruit:
--------------------------------------------------------------------------------
1 | apple
2 | pear
3 | grapes
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/subdir/junk:
--------------------------------------------------------------------------------
1 | apple fritters
2 | grape jam
3 | fried pork rinds
4 |
--------------------------------------------------------------------------------
/t/swamp/groceries/subdir/meat:
--------------------------------------------------------------------------------
1 | pork
2 | beef
3 | chicken
4 |
--------------------------------------------------------------------------------
/t/swamp/html.htm:
--------------------------------------------------------------------------------
1 |
2 | Boring test file
3 | but trying to be conforming anyway
4 |
5 |
6 |
--------------------------------------------------------------------------------
/t/swamp/html.html:
--------------------------------------------------------------------------------
1 |
2 | Boring test file
3 | but trying to be conforming anyway
4 |
5 |
6 |
--------------------------------------------------------------------------------
/t/swamp/incomplete-last-line.txt:
--------------------------------------------------------------------------------
1 | This is a file
2 | with three lines of text
3 | but no new line on the last line!
--------------------------------------------------------------------------------
/t/swamp/javascript.js:
--------------------------------------------------------------------------------
1 | // JavaScript goodness
2 |
3 | // Files and directory structures
4 | var cssDir = "./Stylesheets/";
5 | var NS4CSS = "wango.css";
6 |
7 |
--------------------------------------------------------------------------------
/t/swamp/lua-shebang-test:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env lua
2 |
3 | print 'Hello, World!'
4 |
--------------------------------------------------------------------------------
/t/swamp/minified.js.min:
--------------------------------------------------------------------------------
1 | var cssDir="./Stylesheets/";var NS4CSS="wango.css"
2 |
--------------------------------------------------------------------------------
/t/swamp/minified.min.js:
--------------------------------------------------------------------------------
1 | var cssDir="./Stylesheets/";var NS4CSS="wango.css"
2 |
--------------------------------------------------------------------------------
/t/swamp/moose-andy.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyondgrep/ack3/b304dbee1cb4d125c6d44f191be8cd758c88acc3/t/swamp/moose-andy.jpg
--------------------------------------------------------------------------------
/t/swamp/not-an-#emacs-workfile#:
--------------------------------------------------------------------------------
1 | This is NOT a scratch emacs workfile.
2 |
3 | It sort of looks like one, but it's not.
4 |
5 | The filename kind of matches, but not really.
6 |
--------------------------------------------------------------------------------
/t/swamp/notaMakefile:
--------------------------------------------------------------------------------
1 | This is just a plain old textfile that has a name that looks like
2 | "Makefile" but indeed is not. However, it should not match --make.
3 |
--------------------------------------------------------------------------------
/t/swamp/notaRakefile:
--------------------------------------------------------------------------------
1 | This is just a plain old textfile that has a name that looks like
2 | "Rakefile" but indeed is not. However, it should not match --rake
3 | or --ruby.
4 |
--------------------------------------------------------------------------------
/t/swamp/notes.md:
--------------------------------------------------------------------------------
1 | # Notes
2 |
3 | * One
4 | * Two
5 | * Three
6 |
--------------------------------------------------------------------------------
/t/swamp/options-crlf.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | use strict;
3 | use warnings;
4 |
5 | =head1 NAME
6 |
7 | options - Test file for ack command line options
8 |
9 | =cut
10 |
11 | [abc]
12 |
13 | @Q_fields = split(/\b(?:a|b|c)\b/)
14 |
15 | __DATA__
16 | THIS IS ALL IN UPPER CASE
17 |
18 | this is a word here
19 | notawordhere
20 |
--------------------------------------------------------------------------------
/t/swamp/options.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | use strict;
3 | use warnings;
4 |
5 | =head1 NAME
6 |
7 | options - Test file for ack command line options
8 |
9 | =cut
10 |
11 | [abc]
12 |
13 | @Q_fields = split(/\b(?:a|b|c)\b/)
14 |
15 | __DATA__
16 | THIS IS ALL IN UPPER CASE
17 |
18 | this is a word here
19 | notawordhere
20 |
--------------------------------------------------------------------------------
/t/swamp/options.pl.bak:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 | use strict;
3 | use warnings;
4 |
5 | =head1 NAME
6 |
7 | Backup of options - Test file for ack command line options
8 |
9 | =cut
10 |
11 | [abc]
12 |
13 | @Q_fields = split(/\b(?:a|b|c)\b/)
14 |
15 | __DATA__
16 | THIS IS ALL IN UPPER CASE
17 |
18 | this is a word here
19 | notawordhere
20 |
--------------------------------------------------------------------------------
/t/swamp/perl-test.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 | use Test::More tests => 1;
6 |
7 | BEGIN {
8 | use_ok( 'App::Ack' );
9 | }
10 |
11 | diag( "Testing App::Ack $App::Ack::VERSION, Perl $], $^X" );
12 |
--------------------------------------------------------------------------------
/t/swamp/perl-without-extension:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -w
2 |
3 | use strict;
4 | use warnings;
5 | print "I'm a Perl program without an extension\n";
6 |
--------------------------------------------------------------------------------
/t/swamp/perl.cgi:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 | use Test::More tests => 1;
6 |
7 | BEGIN {
8 | use_ok( 'App::Ack' );
9 | }
10 |
11 | diag( "Testing App::Ack $App::Ack::VERSION, Perl $], $^X" );
12 |
--------------------------------------------------------------------------------
/t/swamp/perl.handler.pod:
--------------------------------------------------------------------------------
1 | =head1 I'm Here!
2 |
3 | =cut
4 |
--------------------------------------------------------------------------------
/t/swamp/perl.pl:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 | use Test::More tests => 1;
6 |
7 | BEGIN {
8 | use_ok( 'App::Ack' );
9 | }
10 |
11 | diag( "Testing App::Ack $App::Ack::VERSION, Perl $], $^X" );
12 |
--------------------------------------------------------------------------------
/t/swamp/perl.pm:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 | use Test::More tests => 1;
6 |
7 | BEGIN {
8 | use_ok( 'App::Ack' );
9 | }
10 |
11 | diag( "Testing App::Ack $App::Ack::VERSION, Perl $], $^X" );
12 |
--------------------------------------------------------------------------------
/t/swamp/perl.pod:
--------------------------------------------------------------------------------
1 | =head1 Dummy document
2 |
3 | =head2 There's important stuff in here!
4 |
--------------------------------------------------------------------------------
/t/swamp/perl.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyondgrep/ack3/b304dbee1cb4d125c6d44f191be8cd758c88acc3/t/swamp/perl.tar.gz
--------------------------------------------------------------------------------
/t/swamp/perltoot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyondgrep/ack3/b304dbee1cb4d125c6d44f191be8cd758c88acc3/t/swamp/perltoot.jpg
--------------------------------------------------------------------------------
/t/swamp/pipe-stress-freaks.F:
--------------------------------------------------------------------------------
1 | PROGRAM FORMAT
2 | IMPLICIT NONE
3 | REAL :: X
4 | CHARACTER (LEN=11) :: FORM1
5 | CHARACTER (LEN=*), PARAMETER :: FORM2 = "( F12.3,A )"
6 | FORM1 = "( F12.3,A )"
7 | X = 12.0
8 | PRINT FORM1, X, ' HELLO '
9 | WRITE (*, FORM2) 2*X, ' HI '
10 | WRITE (*, "(F12.3,A )") 3*X, ' HI HI '
11 | END
12 |
--------------------------------------------------------------------------------
/t/swamp/sample.asp:
--------------------------------------------------------------------------------
1 |
2 |
3 | ASP Example
4 |
5 |
6 | <% Response.Write "Hello!" %>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/t/swamp/sample.aspx:
--------------------------------------------------------------------------------
1 | <%
2 | example.Text = "Example";
3 | %>
4 |
5 |
6 |
7 | Sample ASP.Net Page
8 |
9 |
10 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/t/swamp/sample.rake:
--------------------------------------------------------------------------------
1 | task :ruby_env do
2 | RUBY_APP = if RUBY_PLATFORM =~ /java/
3 | "jruby"
4 | else
5 | "ruby"
6 | end unless defined? RUBY_APP
7 | end
8 |
--------------------------------------------------------------------------------
/t/swamp/service.svc:
--------------------------------------------------------------------------------
1 | <%@ ServiceHost Language="C#" Service="SampleService" %>
2 |
--------------------------------------------------------------------------------
/t/swamp/solution8.tar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/beyondgrep/ack3/b304dbee1cb4d125c6d44f191be8cd758c88acc3/t/swamp/solution8.tar
--------------------------------------------------------------------------------
/t/swamp/stuff.cmake:
--------------------------------------------------------------------------------
1 | # Not actually a cmake file!
2 |
--------------------------------------------------------------------------------
/t/swamp/swamp/ignoreme.txt:
--------------------------------------------------------------------------------
1 | quux
2 |
--------------------------------------------------------------------------------
/t/swamp/test.py:
--------------------------------------------------------------------------------
1 | # test.py is NOT a pytest test, but is Python.
2 |
3 | code = 0
4 |
5 | # This should fail
6 | assert code == 1
7 |
--------------------------------------------------------------------------------
/t/swamp/test_foo.py:
--------------------------------------------------------------------------------
1 | # test_foo.py IS a pytest test, as well as Python.
2 | # This test doesn't test anything meaningful. It's just here for filetype tests.
3 | # But it should pass.
4 |
5 | def test_reality():
6 | code = 1
7 | assert code == 1
8 |
--------------------------------------------------------------------------------
/t/test-pager:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 |
3 | use strict;
4 | use warnings;
5 |
6 | use Getopt::Long;
7 |
8 | my $skip;
9 |
10 | GetOptions(
11 | 'skip=i' => \$skip,
12 | );
13 |
14 | while (<>) {
15 | if ( defined $skip && $. % $skip == 0 ) {
16 | next;
17 | }
18 | print;
19 | }
20 |
--------------------------------------------------------------------------------
/t/text/bill-of-rights.txt:
--------------------------------------------------------------------------------
1 | # Amendment I
2 |
3 | Congress shall make no law respecting an establishment of religion,
4 | or prohibiting the free exercise thereof; or abridging the freedom of
5 | speech, or of the press; or the right of the people peaceably to assemble,
6 | and to petition the Government for a redress of grievances.
7 |
8 | # Amendment II
9 |
10 | A well regulated Militia, being necessary to the security of a free State,
11 | the right of the people to keep and bear Arms, shall not be infringed.
12 |
13 | # Amendment III
14 |
15 | No Soldier shall, in time of peace be quartered in any house, without
16 | the consent of the Owner, nor in time of war, but in a manner to be
17 | prescribed by law.
18 |
19 | # Amendment IV
20 |
21 | The right of the people to be secure in their persons, houses, papers,
22 | and effects, against unreasonable searches and seizures, shall not
23 | be violated, and no Warrants shall issue, but upon probable cause,
24 | supported by Oath or affirmation, and particularly describing the place
25 | to be searched, and the persons or things to be seized.
26 |
27 | # Amendment V
28 |
29 | No person shall be held to answer for a capital, or otherwise infamous
30 | crime, unless on a presentment or indictment of a Grand Jury, except in
31 | cases arising in the land or naval forces, or in the Militia, when in
32 | actual service in time of War or public danger; nor shall any person
33 | be subject for the same offence to be twice put in jeopardy of life
34 | or limb; nor shall be compelled in any criminal case to be a witness
35 | against himself, nor be deprived of life, liberty, or property, without
36 | due process of law; nor shall private property be taken for public use,
37 | without just compensation.
38 |
39 | # Amendment VI
40 |
41 | In all criminal prosecutions, the accused shall enjoy the right to a
42 | speedy and public trial, by an impartial jury of the State and district
43 | wherein the crime shall have been committed, which district shall have
44 | been previously ascertained by law, and to be informed of the nature and
45 | cause of the accusation; to be confronted with the witnesses against
46 | him; to have compulsory process for obtaining witnesses in his favor,
47 | and to have the Assistance of Counsel for his defence.
48 |
49 | # Amendment VII
50 |
51 | In Suits at common law, where the value in controversy shall exceed
52 | twenty dollars, the right of trial by jury shall be preserved, and no
53 | fact tried by a jury, shall be otherwise re-examined in any Court of
54 | the United States, than according to the rules of the common law.
55 |
56 | # Amendment VIII
57 |
58 | Excessive bail shall not be required, nor excessive fines imposed,
59 | nor cruel and unusual punishments inflicted.
60 |
61 | # Amendment IX
62 |
63 | The enumeration in the Constitution, of certain rights, shall not be
64 | construed to deny or disparage others retained by the people.
65 |
66 | # Amendment X
67 |
68 | The powers not delegated to the United States by the Constitution, nor
69 | prohibited by it to the States, are reserved to the States respectively,
70 | or to the people.
71 |
--------------------------------------------------------------------------------
/t/text/gettysburg.txt:
--------------------------------------------------------------------------------
1 | Four score and seven years ago our fathers brought forth on this
2 | continent, a new nation, conceived in Liberty, and dedicated to the
3 | proposition that all men are created equal.
4 |
5 | Now we are engaged in a great civil war, testing whether that nation,
6 | or any nation so conceived and so dedicated, can long endure. We are met
7 | on a great battle-field of that war. We have come to dedicate a portion
8 | of that field, as a final resting place for those who here gave their
9 | lives that that nation might live. It is altogether fitting and proper
10 | that we should do this.
11 |
12 | But, in a larger sense, we can not dedicate -- we can not consecrate --
13 | we can not hallow -- this ground. The brave men, living and dead, who
14 | struggled here, have consecrated it, far above our poor power to add or
15 | detract. The world will little note, nor long remember what we say here,
16 | but it can never forget what they did here. It is for us the living,
17 | rather, to be dedicated here to the unfinished work which they who
18 | fought here have thus far so nobly advanced. It is rather for us to be
19 | here dedicated to the great task remaining before us -- that from these
20 | honored dead we take increased devotion to that cause for which they gave
21 | the last full measure of devotion -- that we here highly resolve that
22 | these dead shall not have died in vain -- that this nation, under God,
23 | shall have a new birth of freedom -- and that government of the people,
24 | by the people, for the people, shall not perish from the earth.
25 |
--------------------------------------------------------------------------------
/t/text/movies.txt:
--------------------------------------------------------------------------------
1 | 1941: Aykroyd, Belushi
2 | Animal House: Belushi, Matheson, Sutherland
3 | Blazing Saddles: Brooks, Kahn, Korman, Little, Pickens, Wilder
4 | The Blues Brothers: Aykroyd, Belushi, Candy, Fisher
5 | Caddyshack: Chase, Dangerfield, Murray
6 | Dragnet: Aykroyd, Hanks
7 | Elf: Asner, Caan, Deschanel, Ferrell, Newhart, Steenburgen
8 | Ghostbusters: Aykroyd, Murray, Moranis, Ramis
9 | Groundhog Day: Elliott, Murray
10 | Little Shop of Horrors: Guest, Martin, Moranis, Murray
11 | My Blue Heaven: Martin, Moranis
12 | Neighbors: Aykroyd, Belushi
13 | Parenthood: Martin, Steenburgen
14 | Planes, Trains and Automobiles: Candy, Martin, McKean
15 | The Princess Bride: Elwes, Falk, Guest, Patinkin, Shawn
16 | Roxanne: Martin, Willard
17 | Silver Streak: Pryor, Wilder, Willard
18 | Spaceballs: Candy, Moranis, Pullman, Rivers
19 | Stir Crazy: Pryor, Willard
20 | Stripes: Candy, Murray, Ramis
21 | This is Spinal Tap: Crystal, Guest, Hendra, Kirby, McKean, Reiner, Shearer, Willard
22 | Three Amigos: Chase, Martin, Short
23 | Trading Places: Akyroyd, Murphy
24 | Vacation: Candy, Chase, D'Angelo
25 | Waiting For Guffman: Guest, Levy, O'Hara, Willard
26 | When Harry Met Sally: Crystal, Fisher, Kirby, Ryan
27 | Young Frankenstein: Feldman, Garr, Kahn, Leachmann, Wilder
28 |
--------------------------------------------------------------------------------
/t/text/number.txt:
--------------------------------------------------------------------------------
1 | 86700
2 |
--------------------------------------------------------------------------------
/t/text/numbered-text.txt:
--------------------------------------------------------------------------------
1 | This is line 01
2 | This is line 02
3 | This is line 03
4 | This is line 04
5 | This is line 05
6 | This is line 06
7 | This is line 07
8 | This is line 08
9 | This is line 09
10 | This is line 10
11 | This is line 11
12 | This is line 12
13 | This is line 13
14 | This is line 14
15 | This is line 15
16 | This is line 16
17 | This is line 17
18 | This is line 18
19 | This is line 19
20 | This is line 20
21 |
--------------------------------------------------------------------------------
/t/text/ozymandias.txt:
--------------------------------------------------------------------------------
1 | I met a traveller from an antique land
2 | Who said: Two vast and trunkless legs of stone
3 | Stand in the desert... Near them, on the sand,
4 | Half sunk, a shattered visage lies, whose frown,
5 | And wrinkled lip, and sneer of cold command,
6 | Tell that its sculptor well those passions read
7 | Which yet survive, stamped on these lifeless things,
8 | The hand that mocked them, and the heart that fed:
9 | And on the pedestal these words appear:
10 | 'My name is Ozymandias, king of kings:
11 | Look on my works, ye Mighty, and despair!'
12 | Nothing beside remains. Round the decay
13 | Of that colossal wreck, boundless and bare
14 | The lone and level sands stretch far away.
15 |
--------------------------------------------------------------------------------
/t/trailing-whitespace.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 |
6 | use Test::More;
7 |
8 | use lib 't';
9 | use Util;
10 |
11 | plan tests => 4;
12 |
13 | prep_environment();
14 |
15 | subtest 'whitespace+dollar normal' => sub {
16 | plan tests => 4;
17 |
18 | my @expected = ();
19 |
20 | my @files = qw( t/text/ );
21 |
22 | for my $context ( undef, '-A', '-B', '-C' ) {
23 | my @args = qw( \s$ );
24 |
25 | push( @args, $context ) if $context;
26 |
27 | ack_sets_match( [ @args, @files ], \@expected, '\s$ should not match the newlines at the end of a line' );
28 | }
29 | };
30 |
31 | subtest 'whitespace+dollar with -l' => sub {
32 | plan tests => 1;
33 |
34 | my @expected = ();
35 |
36 | my @files = qw( t/text/ );
37 | my @args = qw( \s$ -l );
38 |
39 | ack_sets_match( [ @args, @files ], \@expected, '\s$ should not match the newlines at the end of a line' );
40 | };
41 |
42 | subtest 'whitespace+dollar with -L' => sub {
43 | plan tests => 1;
44 |
45 | my @expected = line_split( <<'HERE' );
46 | t/text/amontillado.txt
47 | t/text/bill-of-rights.txt
48 | t/text/constitution.txt
49 | t/text/gettysburg.txt
50 | t/text/movies.txt
51 | t/text/number.txt
52 | t/text/numbered-text.txt
53 | t/text/ozymandias.txt
54 | t/text/raven.txt
55 | HERE
56 |
57 | my @files = qw( t/text/ );
58 | my @args = qw( \s$ -L --sort );
59 |
60 | ack_sets_match( [ @args, @files ], \@expected, '\s$ should not match the newlines at the end of a line' );
61 | };
62 |
63 | subtest 'whitespace+dollar with -v' => sub {
64 | plan tests => 4;
65 |
66 | my @expected = line_split( <<'HERE' );
67 | I met a traveller from an antique land
68 | Who said: Two vast and trunkless legs of stone
69 | Stand in the desert... Near them, on the sand,
70 | Half sunk, a shattered visage lies, whose frown,
71 | And wrinkled lip, and sneer of cold command,
72 | Tell that its sculptor well those passions read
73 | Which yet survive, stamped on these lifeless things,
74 | The hand that mocked them, and the heart that fed:
75 | And on the pedestal these words appear:
76 | 'My name is Ozymandias, king of kings:
77 | Look on my works, ye Mighty, and despair!'
78 | Nothing beside remains. Round the decay
79 | Of that colossal wreck, boundless and bare
80 | The lone and level sands stretch far away.
81 | HERE
82 |
83 | my @files = qw( t/text/ozymandias.txt );
84 |
85 | for my $context ( undef, '-A', '-B', '-C' ) {
86 | my @args = qw( \s$ -v );
87 |
88 | push( @args, $context ) if $context;
89 |
90 | ack_sets_match( [ @args, @files ], \@expected, '\s$ should not match the newlines at the end of a line' );
91 | }
92 | };
93 |
94 | done_testing();
95 | exit 0;
96 |
--------------------------------------------------------------------------------
/t/yaml.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 |
6 | use Test::More tests => 26;
7 |
8 | use lib 't';
9 | use Util;
10 |
11 | prep_environment();
12 |
13 | MAIN: {
14 | my @yamlfiles = glob( 't/*.yaml' );
15 |
16 | for my $file ( @yamlfiles ) {
17 | subtest $file => sub () {
18 | my @tests = read_tests( $file );
19 |
20 | for my $test ( @tests ) {
21 | my $tempfilename;
22 | if ( my $stdin = $test->{stdin} ) {
23 | my $fh = File::Temp->new( UNLINK => 0 ); # We'll delete it ourselves.
24 | $tempfilename = $fh->filename;
25 | print {$fh} $stdin;
26 | close $fh;
27 | }
28 |
29 | my @args = (
30 | @{$test->{args}},
31 | @{$test->{'args-ack3'} // []},
32 | );
33 | for my $args ( @args ) {
34 | if ( $tempfilename ) {
35 | $args = [ @{$args}, $tempfilename ];
36 | }
37 | subtest $test->{name} . ': ack ' . join( ' ', @{$args} ) => sub {
38 | if ( exists $test->{stderr} ) {
39 | ack_stderr_matches( $args, $test->{stderr}, $test->{name} );
40 | is( get_rc(), $test->{exitcode}, 'Exit code matches' );
41 | }
42 | else {
43 | if ( exists $test->{stdout} ) {
44 | my $stdout = $test->{stdout};
45 | if ( $test->{ordered} ) {
46 | ack_lists_match( $args, $test->{stdout}, $test->{name} );
47 | }
48 | else {
49 | ack_sets_match( $args, $test->{stdout}, $test->{name} );
50 | }
51 | is( get_rc(), $test->{exitcode}, 'Exit code matches' );
52 | }
53 | else {
54 | fail( "stdout must always be specified" );
55 | }
56 | }
57 | }
58 | }
59 | if ( $tempfilename ) {
60 | unlink( $tempfilename );
61 | }
62 | }
63 | };
64 | }
65 | }
66 |
67 |
68 | exit 0;
69 |
--------------------------------------------------------------------------------
/t/zero.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Handle a filename of a literal "0"
3 | args: -f --perl t/swamp
4 | stdout: |
5 | t/swamp/0
6 | t/swamp/constitution-100k.pl
7 | t/swamp/Makefile.PL
8 | t/swamp/options.pl
9 | t/swamp/options-crlf.pl
10 | t/swamp/perl.cgi
11 | t/swamp/perl.handler.pod
12 | t/swamp/perl.pl
13 | t/swamp/perl.pm
14 | t/swamp/perl.pod
15 | t/swamp/perl-test.t
16 | t/swamp/perl-without-extension
17 |
--------------------------------------------------------------------------------
/tack:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | make
3 | perl -Mblib blib/script/ack "$@"
4 |
--------------------------------------------------------------------------------
/xt/coding-standards.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 |
6 | use lib 't';
7 | use File::Next;
8 | use Util;
9 |
10 | use Test::More;
11 |
12 |
13 | # Get all the ack component files.
14 | my @files = ( 'ack' );
15 | my $libs = File::Next::files( { descend_filter => sub { !/\Q.git/ }, file_filter => sub { /\.pm$/ } }, 'lib' );
16 | while ( my $file = $libs->() ) {
17 | push @files, $file;
18 | }
19 | @files == 20 or die 'I should have exactly 20 modules + ack';
20 |
21 | # Get all the test files.
22 | for my $spec ( 't/*.t', 'xt/*.t' ) {
23 | my @these_files = glob( $spec ) or die "Couldn't find any $spec";
24 | push( @files, @these_files );
25 | }
26 |
27 | @files = grep { !/lowercase.t/ } @files; # lowercase.t has hi-bit and it's OK.
28 |
29 | plan tests => scalar @files;
30 |
31 | for my $file ( @files ) {
32 | subtest $file => sub {
33 | plan tests => 3;
34 |
35 | my @lines = read_file( $file );
36 | my $text = join( '', @lines );
37 |
38 | chomp @lines;
39 | my $ok = 1;
40 | my $lineno = 0;
41 | for my $line ( @lines ) {
42 | ++$lineno;
43 | if ( $line =~ /[^ -~]/ ) {
44 | my $col = $-[0] + 1;
45 | diag( "$file has hi-bit characters at $lineno:$col" );
46 | $ok = 0;
47 | }
48 | if ( $line =~ /\s+$/ ) {
49 | diag( "$file has trailing whitespace on line $lineno" );
50 | $ok = 0;
51 | }
52 | }
53 | ok( $ok, "$file: No hi-bit characters found and no trailing whitespace" );
54 | ok( $lines[-1] ne '', "$file: Doesn't end with an empty line" );
55 |
56 | is( index($text, "\t"), -1, "$file should have no embedded tabs" );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/xt/coresubs.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | # Checks that we are not using core C or C except in very specific places.
4 | # Same with C and C.
5 | # Ignore the App::Ack::Docs modules since they're nothing but text.
6 |
7 | ## no critic ( Bangs::ProhibitDebuggingModules )
8 |
9 | use warnings;
10 | use strict;
11 |
12 | use Test::More tests => 4;
13 |
14 | use lib 't';
15 | use Util;
16 |
17 | prep_environment();
18 |
19 | my $ack_pm = quotemeta( reslash( 'blib/lib/App/Ack.pm' ) );
20 |
21 | my @exclusions = qw(
22 | --ignore-dir=dev
23 | --ignore-file=is:ack-standalone
24 | );
25 |
26 | for my $word ( qw( warn die ) ) {
27 | subtest "Finding $word" => sub {
28 | plan tests => 4;
29 |
30 | my @args = ( '(? or C. Use C and C.
40 | my $util_pm = quotemeta( reslash( 't/Util.pm' ) );
41 | for my $word ( qw( chdir mkdir ) ) {
42 | subtest "Finding $word" => sub {
43 | plan tests => 3;
44 |
45 | my @args = ( '-w', '--ignore-file=is:coresubs.t', '--ignore-file=is:Dockerfile', '--ignore-dir=garage', @exclusions, $word );
46 | my @results = run_ack( @args );
47 |
48 | is( scalar @results, 1, 'Exactly one hit...' ) or do { require Data::Dumper; warn Data::Dumper::Dumper( \@results ) };
49 | like( $results[0], qr/^$util_pm.+CORE::$word/, '... and it is in the function in Util.pm that wraps the core call' );
50 | };
51 | }
52 |
53 | exit 0;
54 |
--------------------------------------------------------------------------------
/xt/pod.t:
--------------------------------------------------------------------------------
1 | #!perl
2 |
3 | use warnings;
4 | use strict;
5 |
6 | use Test::More;
7 |
8 | use Test::Pod 1.14;
9 | all_pod_files_ok();
10 |
--------------------------------------------------------------------------------