Hello community, here is the log from the commit of package ack for openSUSE:Factory checked in at 2017-03-12 20:05:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ack (Old) and /work/SRC/openSUSE:Factory/.ack.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ack" Sun Mar 12 20:05:38 2017 rev:20 rq:478712 version:2.16 Changes: -------- --- /work/SRC/openSUSE:Factory/ack/ack.changes 2016-02-07 09:22:55.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ack.new/ack.changes 2017-03-12 20:05:39.307704677 +0100 @@ -1,0 +2,11 @@ +Sat Mar 11 19:13:25 UTC 2017 - [email protected] + +- ack 2.16: + * Include .cljs, .cljc and .edn files with the --clojure filetype + * Add .xsd to the --xml filetype + * Add support for Swift language + * The MSYS2 project is now seen as Windows + * Expand the definition of OCaml files + * Add support for Groovy Server Pages + +------------------------------------------------------------------- Old: ---- ack-2.15_02.tar.gz New: ---- ack-2.16.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ack.spec ++++++ --- /var/tmp/diff_new_pack.KpF2LS/_old 2017-03-12 20:05:40.067597149 +0100 +++ /var/tmp/diff_new_pack.KpF2LS/_new 2017-03-12 20:05:40.075596018 +0100 @@ -1,7 +1,7 @@ # # spec file for package ack # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,8 +22,9 @@ %else %define with_pod 0 %endif +%{!?perl_make_install: %global perl_make_install make DESTDIR=%{buildroot} install_vendor} Name: ack -Version: 2.15_02 +Version: 2.16 Release: 0 Summary: Grep-Like Text Finder License: Artistic-2.0 @@ -40,7 +41,6 @@ Requires: perl-base = %{perl_version} BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch -%{!?perl_make_install: %global perl_make_install make DESTDIR=%{buildroot} install_vendor} %if %{run_tests} BuildRequires: perl(File::Temp) >= 0.19 BuildRequires: perl(IO::Pty) @@ -55,8 +55,8 @@ %package -n perl-App-Ack Summary: Grep-Like Text Finder Perl Module Group: Development/Libraries/Perl -Requires: perl(File::Next) >= 1.10 Requires: perl-base = %{perl_version} +Requires: perl(File::Next) >= 1.10 %description -n perl-App-Ack App::Ack is a grep-like tool tailored to working with large trees of source @@ -99,7 +99,7 @@ %defattr(-,root,root) %doc rpmdoc_ack/* %{_bindir}/ack -%doc %{_mandir}/man1/ack.1%{ext_man} +%{_mandir}/man1/ack.1%{ext_man} %files -n perl-App-Ack %defattr(-,root,root) ++++++ ack-2.15_02.tar.gz -> ack-2.16.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/Ack.pm new/ack-2.16/Ack.pm --- old/ack-2.15_02/Ack.pm 2015-12-17 22:59:10.000000000 +0100 +++ new/ack-2.16/Ack.pm 2017-03-10 20:50:16.000000000 +0100 @@ -9,15 +9,15 @@ =head1 VERSION -Version 2.15_02 +Version 2.16 =cut our $VERSION; our $COPYRIGHT; BEGIN { - $VERSION = '2.15_02'; - $COPYRIGHT = 'Copyright 2005-2015 Andy Lester.'; + $VERSION = '2.16'; + $COPYRIGHT = 'Copyright 2005-2017 Andy Lester.'; } our $fh; @@ -46,7 +46,7 @@ $output_to_pipe = not -t *STDOUT; $is_filter_mode = -p STDIN; - $is_cygwin = ($^O eq 'cygwin'); + $is_cygwin = ($^O eq 'cygwin' || $^O eq 'msys'); $is_windows = ($^O eq 'MSWin32'); $dir_sep_chars = $is_windows ? quotemeta( '\\/' ) : quotemeta( File::Spec->catfile( '', '' ) ); } @@ -578,7 +578,7 @@ =head1 COPYRIGHT & LICENSE -Copyright 2005-2015 Andy Lester. +Copyright 2005-2017 Andy Lester. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/Changes new/ack-2.16/Changes --- old/ack-2.15_02/Changes 2015-12-17 22:59:10.000000000 +0100 +++ new/ack-2.16/Changes 2017-03-10 20:50:16.000000000 +0100 @@ -1,5 +1,53 @@ History file for ack. http://beyondgrep.com/ + +2.16 Fri Mar 10 13:32:39 CST 2017 +==================================== +No changes since 2.15_03. + +[CONFUSING BEHAVIOR & UPCOMING CHANGES] +The -w has a confusing behavior that it's had since back to ack 1.x +that will be changing in the future. It's not changing in this +version, but this is a heads-up that it's coming. + +ack -w is "match a whole word", and ack does this by putting turning +your PATTERN into \bPATTERN\b. So "ack -w foo" effectively becomes +"ack \bfoo\b". Handy. + +The problem is that ack doesn't put a \b before PATTERN if it begins +with a non-word character, and won't put a \b after PATTERN if it +ends with a non-word character. + +The problem is that if you're searching for "fool" or "foot", but +only as a word, and you do "ack -w foo[lt]" or "ack -w (fool|foot)", +you'll get matches for "football and foolish" which certainly should +not match if you're using -w. + + +2.15_03 Sun Feb 26 23:07:35 CST 2017 +==================================== +[ENHANCEMENTS] +Include .cljs, .cljc and .edn files with the --clojure filetype. Thanks, +Austin Chamberlin. + +Added .xsd to the --xml filetype. Thanks, Nick Morrott. + +Added support for Swift language. Thanks, Nikolaj Schumacher. (GH #512) + +The MSYS2 project is now seen as Windows. Thanks, Ray Donnelly. (GH #450) + +Expand the definition of OCaml files. Thanks, Marek Kubica. (GH #511) + +Add support for Groovy Server Pages. Thanks, Ethan Mallove. (GH #469) + +[INTERNALS] +Added test to test --output. Thanks, Varadinsky! (GH #587, GH #590) + +[DOCUMENTATION] +Expanded the explanation of how the -w flag works. Thanks, Ed Avis. +(GH #585) + + 2.15_02 Thu Dec 17 15:51:15 CST 2015 ==================================== This is the first dev version in nine months. Many changes have gone @@ -143,7 +191,7 @@ 2.12 Tue Dec 3 07:05:02 CST 2013 ==================================== [SECURITY FIXES] -This verison of ack prevents the --pager, --regex and --output +This version of ack prevents the --pager, --regex and --output options from being used from project-level ackrc files. It is possible to execute malicious code with these options, and we want to prevent the security risk of acking through a potentially malicious diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/ConfigDefault.pm new/ack-2.16/ConfigDefault.pm --- old/ack-2.15_02/ConfigDefault.pm 2015-12-17 22:59:10.000000000 +0100 +++ new/ack-2.16/ConfigDefault.pm 2017-03-08 20:19:15.000000000 +0100 @@ -205,7 +205,7 @@ # Clojure # http://clojure.org/ ---type-add=clojure:ext:clj +--type-add=clojure:ext:clj,cljs,edn,cljc # C # .xs are Perl C files @@ -263,6 +263,10 @@ # http://groovy.codehaus.org/ --type-add=groovy:ext:groovy,gtmpl,gpp,grunit,gradle +# GSP +# http://groovy.codehaus.org/GSP +--type-add=gsp:ext:gsp + # Haskell # http://www.haskell.org/ --type-add=haskell:ext:hs,lhs @@ -310,7 +314,7 @@ # OCaml # http://caml.inria.fr/ ---type-add=ocaml:ext:ml,mli +--type-add=ocaml:ext:ml,mli,mll,mly # Matlab # http://en.wikipedia.org/wiki/MATLAB @@ -384,6 +388,11 @@ # http://learnboost.github.io/stylus/ --type-add=stylus:ext:styl +# Swift +# https://developer.apple.com/swift/ +--type-add=swift:ext:swift +--type-add=swift:firstlinematch:/^#!.*\bswift/ + # Tcl # http://www.tcl.tk/ --type-add=tcl:ext:tcl,itcl,itk @@ -412,7 +421,7 @@ # XML # http://www.w3.org/TR/REC-xml/ ---type-add=xml:ext:xml,dtd,xsl,xslt,ent +--type-add=xml:ext:xml,dtd,xsd,xsl,xslt,ent --type-add=xml:firstlinematch:/<[?]xml/ # YAML diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/ConfigLoader.pm new/ack-2.16/ConfigLoader.pm --- old/ack-2.15_02/ConfigLoader.pm 2015-12-17 22:59:10.000000000 +0100 +++ new/ack-2.16/ConfigLoader.pm 2017-03-08 20:19:15.000000000 +0100 @@ -255,7 +255,7 @@ Try using the --dump flag. EOT -=for Adding-Options +=begin Adding-Options *** IF YOU ARE MODIFYING ACK PLEASE READ THIS *** @@ -274,6 +274,8 @@ whether your new option can be considered mutually exclusive with another option. +=end Adding-Options + =cut return { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/MANIFEST new/ack-2.16/MANIFEST --- old/ack-2.15_02/MANIFEST 2015-12-17 23:01:13.000000000 +0100 +++ new/ack-2.16/MANIFEST 2017-03-10 20:50:31.000000000 +0100 @@ -63,6 +63,7 @@ t/ack-named-pipes.t t/ack-n.t t/ack-o.t +t/ack-output.t t/ack-pager.t t/ack-passthru.t t/ack-print0.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/META.json new/ack-2.16/META.json --- old/ack-2.15_02/META.json 2015-12-17 23:01:13.000000000 +0100 +++ new/ack-2.16/META.json 2017-03-10 20:50:31.000000000 +0100 @@ -4,7 +4,7 @@ "Andy Lester <[email protected]>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001", + "generated_by" : "ExtUtils::MakeMaker version 7.18, CPAN::Meta::Converter version 2.150005", "license" : [ "artistic_2" ], @@ -49,7 +49,7 @@ } } }, - "release_status" : "testing", + "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://github.com/petdance/ack2" @@ -59,9 +59,11 @@ "http://www.perlfoundation.org/artistic_license_2_0" ], "repository" : { + "type" : "git", "url" : "git://github.com/petdance/ack2.git" }, "x_MailingList" : "http://groups.google.com/group/ack-users" }, - "version" : "2.15_02" + "version" : "2.16", + "x_serialization_backend" : "JSON::PP version 2.27203" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/META.yml new/ack-2.16/META.yml --- old/ack-2.15_02/META.yml 2015-12-17 23:01:12.000000000 +0100 +++ new/ack-2.16/META.yml 2017-03-10 20:50:31.000000000 +0100 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001' +generated_by: 'ExtUtils::MakeMaker version 7.18, CPAN::Meta::Converter version 2.150005' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -38,4 +38,5 @@ homepage: http://beyondgrep.com/ license: http://www.perlfoundation.org/artistic_license_2_0 repository: git://github.com/petdance/ack2.git -version: 2.15_02 +version: '2.16' +x_serialization_backend: 'CPAN::Meta::YAML version 0.011' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/Makefile.PL new/ack-2.16/Makefile.PL --- old/ack-2.15_02/Makefile.PL 2015-02-14 00:04:21.000000000 +0100 +++ new/ack-2.16/Makefile.PL 2017-03-08 20:19:15.000000000 +0100 @@ -83,7 +83,7 @@ package MY; -# supress EU::MM test rule +# suppress EU::MM test rule sub MY::test { return ''; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/ack new/ack-2.16/ack --- old/ack-2.15_02/ack 2015-12-17 22:59:10.000000000 +0100 +++ new/ack-2.16/ack 2017-03-10 20:50:16.000000000 +0100 @@ -2,8 +2,7 @@ use strict; use warnings; - -our $VERSION = '2.15_02'; # Check http://beyondgrep.com/ for updates +our $VERSION = '2.16'; # Check http://beyondgrep.com/ for updates use 5.008008; use Getopt::Long 2.38 (); @@ -393,7 +392,7 @@ return; } -=for Developers +=begin Developers This subroutine jumps through a number of optimization hoops to try to be fast in the more common use cases of ack. For one thing, @@ -405,6 +404,8 @@ does_match for performance reasons; any relevant changes that happen here must also happen there. +=end Developers + =cut sub print_matches_in_resource { @@ -759,12 +760,14 @@ # does_match() MUST have an $opt_regex set. -=for Developers +=begin Developers This subroutine is inlined a few places in print_matches_in_resource for performance reasons, so any changes here must be copied there as well. +=end Developers + =cut sub does_match { @@ -1050,7 +1053,9 @@ App::Ack::exit_from_ack( $nmatches ); } +=pod +=encoding UTF-8 =head1 NAME @@ -1471,6 +1476,21 @@ =item B<-w>, B<--word-regexp> +=item B<-w>, B<--word-regexp> + +Turn on "words mode". This sometimes matches a whole word, but the +semantics is quite subtle. If the passed regexp begins with a word +character, then a word boundary is required before the match. If the +passed regexp ends with a word character, or with a word character +followed by newline, then a word boundary is required after the match. + +Thus, for example, B<-w> with the regular expression C<ox> will not +match the strings C<box> or C<oxen>. However, if the regular +expression is C<(ox|ass)> then it will match those strings. Because +the regular expression's first character is C<(>, the B<-w> flag has +no effect at the start, and because the last character is C<)>, it has +no effect at the end. + Force PATTERN to match only whole words. The PATTERN is wrapped with C<\b> metacharacters. @@ -1512,7 +1532,7 @@ # Always sort the files --sort-files - # Always color, even if piping to a another program + # Always color, even if piping to another program --color # Use "less -r" as my pager @@ -1956,7 +1976,7 @@ =head2 Why does C<"ack '.{40000,}'"> fail? Isn't that a valid regex? -The Perl language limits the repetition quanitifier to 32K. You +The Perl language limits the repetition quantifier to 32K. You can search for C<.{32767}> but not C<.{32768}>. =head2 Ack does "X" and shouldn't, should it? @@ -2235,6 +2255,14 @@ How appropriate to have I<ack>nowledgements! Thanks to everyone who has contributed to ack in any way, including +Ethan Mallove, +Marek Kubica, +Ray Donnelly, +Nikolaj Schumacher, +Ed Avis, +Nick Morrott, +Austin Chamberlin, +Varadinsky, SE<eacute>bastien FeugE<egrave>re, Jakub Wilk, Pete Houston, @@ -2339,7 +2367,7 @@ =head1 COPYRIGHT & LICENSE -Copyright 2005-2015 Andy Lester. +Copyright 2005-2017 Andy Lester. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/t/Util.pm new/ack-2.16/t/Util.pm --- old/ack-2.15_02/t/Util.pm 2015-02-14 00:04:21.000000000 +0100 +++ new/ack-2.16/t/Util.pm 2017-03-10 20:50:16.000000000 +0100 @@ -43,7 +43,7 @@ } sub is_cygwin { - return $^O eq 'cygwin'; + return ($^O eq 'cygwin' || $^O eq 'msys'); } sub is_empty_array { @@ -328,7 +328,7 @@ my ($sig,$core,$rc) = (($? & 127), ($? & 128) , ($? >> 8)); $ack_return_code = $rc; - ## XXX what do do with $core or $sig? + ## XXX what to do with $core or $sig? chomp @stdout; chomp @stderr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/t/ack-filetypes.t new/ack-2.16/t/ack-filetypes.t --- old/ack-2.15_02/t/ack-filetypes.t 2015-02-13 23:17:29.000000000 +0100 +++ new/ack-2.16/t/ack-filetypes.t 2017-03-08 20:19:15.000000000 +0100 @@ -28,6 +28,7 @@ fortran go groovy +gsp haskell hh html @@ -57,6 +58,7 @@ shell smalltalk sql +swift tcl tex tt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/t/ack-ignore-file.t new/ack-2.16/t/ack-ignore-file.t --- old/ack-2.15_02/t/ack-ignore-file.t 2015-12-17 22:59:10.000000000 +0100 +++ new/ack-2.16/t/ack-ignore-file.t 2017-03-08 20:19:15.000000000 +0100 @@ -1,4 +1,4 @@ -#!perl +#!perl -T use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/t/ack-n.t new/ack-2.16/t/ack-n.t --- old/ack-2.15_02/t/ack-n.t 2015-02-14 00:04:21.000000000 +0100 +++ new/ack-2.16/t/ack-n.t 2017-03-08 20:19:15.000000000 +0100 @@ -36,7 +36,7 @@ prep_environment(); -# We sort to ensure determinstic results. +# We sort to ensure deterministic results. @args = ('-n', '--sort-files', 'apple', 't/swamp/groceries'); $lines = run_ack(@args); lists_match $lines, $expected_norecurse, '-n should disable recursion'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/t/ack-output.t new/ack-2.16/t/ack-output.t --- old/ack-2.15_02/t/ack-output.t 1970-01-01 01:00:00.000000000 +0100 +++ new/ack-2.16/t/ack-output.t 2017-03-08 20:19:15.000000000 +0100 @@ -0,0 +1,175 @@ +#!perl -T + +use warnings; +use strict; + +use Test::More tests => 24; + +use lib 't'; +use Util; +use File::Next; + +prep_environment(); + +ARG: { + my @expected = ( + 'Sink, swim, go down with the ship' + ); + + my @files = qw( t/text/freedom-of-choice.txt ); + my @args = qw( swim --output=$_ ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Matching line' ); +} + +ARG_MULTIPLE_FILES: { + my @expected = split( /\n/, <<'HERE' ); +And there you were +He stood there lookin' at me and I saw him smile. +And I knew I wouldn't be there to help ya along. +In the case of Christianity and Judaism there exists the belief +HERE + + my @files = qw( t/text ); + my @args = qw( there --sort-files -h --output=$_ ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Matching line' ); +} + +MATCH: { + my @expected = ( + 'swim' + ); + + my @files = qw( t/text/freedom-of-choice.txt ); + my @args = qw( swim --output=$& ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Part of a line matching pattern' ); +} + +MATCH_MULTIPLE_FILES: { + my @expected = split( /\n/, <<'HERE' ); +t/text/4th-of-july.txt:22:there +t/text/boy-named-sue.txt:48:there +t/text/boy-named-sue.txt:52:there +t/text/science-of-myth.txt:3:there +HERE + + my @files = qw ( t/text ); + my @args = qw( there --sort-files --output=$& ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Part of a line matching pattern' ); +} + +PREMATCH: { + my @expected = ( + 'Sink, ' + ); + + my @files = qw( t/text/freedom-of-choice.txt ); + my @args = qw( swim --output=$` ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Part of a line preceding match' ); +} + +PREMATCH_MULTIPLE_FILES: { + +# No HEREDOC here since we do not want our editor/IDE messing with trailing whitespace. + my @expected = ( + "And ", + "He stood ", + "And I knew I wouldn't be ", + "In the case of Christianity and Judaism " ); + + my @files = qw( t/text/); + my @args = qw( there -h --sort-files --output=$` ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Part of a line preceding match' ); +} + +POSTMATCH: { + my @expected = ( + ', go down with the ship' + ); + + my @files = qw( t/text/freedom-of-choice.txt ); + my @args = qw( swim --output=$' ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Part of a line that follows match' ); +} + +POSTMATCH_MULTIPLE_FILES: { + my @expected = split( /\n/, <<'HERE' ); + you were + lookin' at me and I saw him smile. + to help ya along. + exists the belief +HERE + + my @files = qw( t/text/ ); + my @args = qw( there -h --sort-files --output=$' ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Part of a line that follows match' ); +} + +SUBPATTERN_MATCH: { + my @expected = ( + 'Sink-swim-ship' + ); + + my @files = qw( t/text/freedom-of-choice.txt ); + my @args = qw( ^(Sink).+(swim).+(ship)$ --output=$1-$2-$3 ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Capturing parentheses match' ); +} + +SUBPATTERN_MATCH_MULTIPLE_FILES: { + my @expected = split( /\n/, <<'HERE' ); +And-there-you +stood-there-lookin +be-there-to +Judaism-there-exists +HERE + + my @files = qw( t/text/ ); + my @args = qw( (\w+)\s(there)\s(\w+) -h --sort-files --output=$1-$2-$3 ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Capturing parentheses match' ); +} + +INPUT_LINE_NUMBER: { + my @expected = ( + 'line:3' + ); + + my @files = qw( t/text/freedom-of-choice.txt ); + my @args = qw( swim --output=line:$. ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Line number' ); +} + +INPUT_LINE_NUMBER_MULTIPLE_FILES: { + my @expected = split( /\n/, <<'HERE' ); +t/text/4th-of-july.txt:22:line:22 +t/text/boy-named-sue.txt:48:line:48 +t/text/boy-named-sue.txt:52:line:52 +t/text/science-of-myth.txt:3:line:3 +HERE + + my @files = qw( t/text/ ); + my @args = qw( there --sort-files --output=line:$. ); + my @results = run_ack( @args, @files ); + + lists_match( \@results, \@expected, 'Line number' ); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ack-2.15_02/t/ack-w.t new/ack-2.16/t/ack-w.t --- old/ack-2.15_02/t/ack-w.t 2015-12-17 22:59:10.000000000 +0100 +++ new/ack-2.16/t/ack-w.t 2017-03-10 20:26:51.000000000 +0100 @@ -3,7 +3,7 @@ use warnings; use strict; -use Test::More tests => 8; +use Test::More tests => 16; use lib 't'; use Util; @@ -36,10 +36,15 @@ TRAILING_METACHAR_DOT: { - local $TODO = q{I can't figure why the -w works from the command line, but not inside this test}; + # Because the . at the end of the regular expression is not a word + # character, a word boundary is not required after the match. my @expected = ( + "And he didn't leave very much for my Ma and me", + 'Well, he must have thought that it was quite a joke', 'At an old saloon on a street of mud,', 'Kicking and a-gouging in the mud and the blood and the beer.', + 'He kicked like a mule and he bit like a crocodile.', + 'Science and religion are not mutually exclusive', ); my @files = qw( t/text ); @@ -48,6 +53,74 @@ ack_lists_match( [ @args, @files ], \@expected, 'Looking for mu.' ); } +BEGINS_AND_ENDS_WITH_WORD_CHAR: { + # Normal case of whole word match. + my @expected = ( + 'And I said: "My name is Sue! How do you do! Now you gonna die!"', + "To kill me now, and I wouldn't blame you if you do.", + ); + + my @files = qw( t/text ); + my @args = ( 'do', qw( -w -h --sort-files ) ); + + ack_lists_match( [ @args, @files ], \@expected, 'Looking for do as whole word' ); +} + +BEGINS_BUT_NOT_ENDS_WITH_WORD_CHAR: { + # The last character of the regexp is not a word, disabling the word boundary check at the end of the match. + my @expected = ( + 'But use your freedom of choice', + 'Took us all the way to New Orleans', + 'While other religions use the literal core to build foundations with', + ); + + my @files = qw( t/text ); + my @args = ( 'us()', qw( -w -h --sort-files ) ); + + ack_lists_match( [ @args, @files ], \@expected, 'Looking for us with word flag, but regexp does not end with word char' ); +} + +ENDS_BUT_NOT_BEGINS_WITH_WORD_CHAR: { + # The first character of the regexp is not a word, disabling the word boundary check at the start of the match. + my @expected = ( + 'Alone with the morning burning red', + 'If you ain\'t got no one', + 'He said: "Now you just fought one hell of a fight', + 'He picked at one', + 'He picked at one', + 'Through all kinds of weather and everything we done', + 'But I\'d trade all of my tomorrows for one single yesterday', + 'If you\'ve ever questioned beliefs that you\'ve hold, you\'re not alone', + 'And the simple truth is that it\'s none of that \'cause', + 'And if it works, then it gets the job done', + 'Anyone caught outside the gates of their subdivision sector after curfew will be shot.', + 'Anyone gaught intefering with the collection of urine samples will be shot.', + 'The number one enemy of progress is questions.', + 'At last everything is done for you.', + ); + + my @files = qw( t/text ); + my @args = ( '()one', qw( -w -h --sort-files ) ); + + ack_lists_match( [ @args, @files ], \@expected, 'Looking for one with word flag, but regexp does not begin with word char' ); +} + +NEITHER_BEGINS_NOR_ENDS_WITH_WORD_CHAR: { + # Because the regular expression doesn't begin or end with a word character, the 'words mode' doesn't affect the match. + my @expected = ( + 'In the case of Christianity and Judaism there exists the belief', + 'While other religions use the literal core to build foundations with', + 'See, half the world sees the myth as fact, and it\'s seen as a lie by the other half', + 'Consider the case of the woman whose faith helped her make it through', + 'When she was raped and cut up, left for dead in her trunk, her beliefs held true' + ); + + my @files = qw( t/text/science-of-myth.txt ); + my @args = ( '(her)', qw( -w -h --sort-files ) ); + + ack_lists_match( [ @args, @files ], \@expected, 'Looking for her with word flag, but regexp does not begin or end with word char' ); +} + # Test for issue #443 ALTERNATING_NUMBERS: { my @expected = ();
