summaryrefslogtreecommitdiff
path: root/t/t4018-diff-funcname.sh
AgeCommit message (Collapse)AuthorFilesLines
2021-12-13t4000-t4999: detect and signal failure within loopLibravatar Eric Sunshine1-1/+1
Failures within `for` and `while` loops can go unnoticed if not detected and signaled manually since the loop itself does not abort when a contained command fails, nor will a failure necessarily be detected when the loop finishes since the loop returns the exit code of the last command it ran on the final iteration, which may not be the command which failed. Therefore, detect and signal failures manually within loops using the idiom `|| return 1` (or `|| exit 1` within subshells). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-04-08userdiff: remove support for "broken" testsLibravatar Ævar Arnfjörð Bjarmason1-7/+1
There have been no "broken" tests since 75c3b6b2e8 (userdiff: improve Fortran xfuncname regex, 2020-08-12). Let's remove the test support for them. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-04-08userdiff tests: list builtin drivers via test-toolLibravatar Ævar Arnfjörð Bjarmason1-27/+19
Change the userdiff test to list the builtin drivers via the test-tool, using the new for_each_userdiff_driver() API function. This gets rid of the need to modify this part of the test every time a new pattern is added, see 2ff6c34612 (userdiff: support Bash, 2020-10-22) and 09dad9256a (userdiff: support Markdown, 2020-05-02) for two recent examples. I only need the "list-builtin-drivers "argument here, but let's add "list-custom-drivers" and "list-drivers" too, just because it's easy. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-04-08userdiff tests: explicitly test "default" patternLibravatar Ævar Arnfjörð Bjarmason1-0/+1
Since 122aa6f9c0 (diff: introduce diff.<driver>.binary, 2008-10-05) the internals of the userdiff.c code have understood a "default" name, which is invoked as userdiff_find_by_name("default") and present in the "builtin_drivers" struct. Let's test for this special case. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-10-22userdiff: support BashLibravatar Victor Engmark1-0/+1
Support POSIX, bashism and mixed function declarations, all four compound command types, trailing comments and mixed whitespace. Even though Bash allows locale-dependent characters in function names <https://unix.stackexchange.com/a/245336/3645>, only detect function names with characters allowed by POSIX.1-2017 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_235> for simplicity. This should cover the vast majority of use cases, and produces system-agnostic results. Since a word pattern has to be specified, but there is no easy way to know the default word pattern, use the default `IFS` characters for a starter. A later patch can improve this. Signed-off-by: Victor Engmark <victor@engmark.name> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-05-02userdiff: support MarkdownLibravatar Ash Holland1-0/+1
It's typical to find Markdown documentation alongside source code, and having better context for documentation changes is useful; see also commit 69f9c87d4 (userdiff: add support for Fountain documents, 2015-07-21). The pattern is based on the CommonMark specification 0.29, section 4.2 <https://spec.commonmark.org/> but doesn't match empty headings, as seeing them in a hunk header is unlikely to be useful. Only ATX headings are supported, as detecting setext headings would require printing the line before a pattern matches, or matching a multiline pattern. The word-diff pattern is the same as the pattern for HTML, because many Markdown parsers accept inline HTML. Signed-off-by: Ash Holland <ash@sorrel.sh> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-01-30Merge branch 'jk/test-fixes'Libravatar Junio C Hamano1-1/+0
Test fixes. * jk/test-fixes: t7800: don't rely on reuse_worktree_file() t4018: drop "debugging" cat from hunk-header tests
2020-01-16t4018: drop "debugging" cat from hunk-header testsLibravatar Jeff King1-1/+0
We run a series of hunk-header tests in a loop, and each one does this: test_when_finished 'cat actual' && # for debugging only This is pretty pointless. When the test succeeds, we waste time running a useless cat process. If you're debugging a failure with "-i", then we won't run the when-finished part at all. So it helps only if you're running with something like "--verbose-log". Since we expect the tests to succeed most of the time, a better way to do this would be a helper that checks the output and dumps "actual" only when it fails. But it's probably not even worth the effort, as anyone debugging a failure could just run with "-i" and investigate the "actual" file themselves. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-11-10userdiff: add Elixir to supported userdiff languagesLibravatar Łukasz Niemier1-0/+1
Adds support for xfuncref in Elixir[1] language which is Ruby-like language that runs on Erlang[3] Virtual Machine (BEAM). [1]: https://elixir-lang.org [2]: https://www.erlang.org Signed-off-by: Łukasz Niemier <lukasz@niemier.pl> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-21userdiff: add a builtin pattern for dts filesLibravatar Stephen Boyd1-0/+1
The Linux kernel receives many patches to the devicetree files each release. The hunk header for those patches typically show nothing, making it difficult to figure out what node is being modified without applying the patch or opening the file and seeking to the context. Let's add a builtin 'dts' pattern to git so that users can get better diff output on dts files when they use the diff=dts driver. The regex has been constructed based on the spec at devicetree.org[1] and with some help from Johannes Sixt. [1] https://github.com/devicetree-org/devicetree-specification/releases/latest Cc: Rob Herring <robh+dt@kernel.org> Cc: Frank Rowand <frowand.list@gmail.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-17userdiff: add built-in pattern for rustLibravatar Marc-André Lureau1-0/+1
This adds xfuncname and word_regex patterns for Rust, a quite popular programming language. It also includes test cases for the xfuncname regex (t4018) and updated documentation. The word_regex pattern finds identifiers, integers, floats and operators, according to the Rust Reference Book. Cc: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-01userdiff: add built-in pattern for golangLibravatar Alban Gruin1-0/+1
This adds xfuncname and word_regex patterns for golang, a quite popular programming language. It also includes test cases for the xfuncname regex (t4018) and updated documentation. The xfuncname regex finds functions, structs and interfaces. Although the Go language prohibits the opening brace from being on its own line, the regex does not makes it mandatory, to be able to match `func` statements like this: func foo(bar int, baz int) { } This is covered by the test case t4018/golang-long-func. The word_regex pattern finds identifiers, integers, floats, complex numbers and operators, according to the go specification. Signed-off-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-03userdiff: add built-in pattern for CSSLibravatar William Duclot1-0/+1
CSS is widely used, motivating it being included as a built-in pattern. It must be noted that the word_regex for CSS (i.e. the regex defining what is a word in the language) does not consider '.' and '#' characters (in CSS selectors) to be part of the word. This behavior is documented by the test t/t4018/css-rule. The logic behind this behavior is the following: identifiers in CSS selectors are identifiers in a HTML/XML document. Therefore, the '.'/'#' character are not part of the identifier, but an indicator of the nature of the identifier in HTML/XML (class or id). Diffing ".class1" and ".class2" must show that the class name is changed, but we still are selecting a class. Logic behind the "pattern" regex is: 1. reject lines ending with a colon/semicolon (properties) 2. if a line begins with a name in column 1, pick the whole line Credits to Johannes Sixt (j6t@kdbg.org) for the pattern regex and most of the tests. Signed-off-by: William Duclot <william.duclot@ensimag.grenoble-inp.fr> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Reviewed-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-23userdiff: add support for Fountain documentsLibravatar Zoë Blade1-0/+1
Add support for Fountain, a plain text screenplay format. Git facilitates not just programming specifically, but creative writing in general, so it makes sense to also support other plain text documents besides source code. In the structure of a screenplay specifically, scenes are roughly analogous to functions, in the sense that it makes your job easier if you can see which ones were changed in a given range of patches. More information about the Fountain format can be found on its official website, at http://fountain.io . Signed-off-by: Zoë Blade <zoe@bytenoise.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-08-13tests: fix negated test_i18ngrep callsLibravatar Johannes Sixt1-4/+4
The helper function test_i18ngrep pretends that it found the expected results when it is running under GETTEXT_POISON. For this reason, it must not be used negated like so ! test_i18ngrep foo bar because the test case would fail under GETTEXT_POISON. The function offers a special syntax to test that a pattern is *not* found: test_i18ngrep ! foo bar Convert incorrect uses to this syntax. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-21t4018: reduce test files for pattern compilation testsLibravatar Johannes Sixt1-38/+14
All test cases that need a file with specific text patterns have been converted to utilize texts in the t4018/ directory. The remaining tests in the test script deal only with the validity of the regular expressions. These tests do not depend on the contents of files that 'git diff' is invoked on. Remove the largish here-document and use only tiny files. While we are touching these tests, convert grep to test_i18ngrep as the texts checked for may undergo translation in the future. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-21t4018: convert custom pattern test to the new infrastructureLibravatar Johannes Sixt1-24/+16
For the test case "matches to end of line", extend the pattern by a few wildcards so that the pattern captures the "RIGHT" token, which is needed for verification, without mentioning it in the pattern. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-21t4018: convert java pattern test to the new infrastructureLibravatar Johannes Sixt1-4/+0
Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-21t4018: convert perl pattern tests to the new infrastructureLibravatar Johannes Sixt1-88/+0
There is one subtlety: The old test case 'perl pattern gets full line of POD header' does not have its own new test case, but the feature is tested nevertheless by placing the RIGHT tag at the end of the expected hunk header in t4018/perl-skip-sub-in-pod. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-21t4018: an infrastructure to test hunk headersLibravatar Johannes Sixt1-6/+54
Add an infrastructure that simplifies adding new tests of the hunk header regular expressions. To add new tests, a file with the syntax to test can be dropped in the directory t4018. The README file explains how a test file must contain; the README itself tests the default behavior. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-28Merge branch 'rr/tests-dedup-test-config'Libravatar Junio C Hamano1-5/+0
* rr/tests-dedup-test-config: t4018,7810,7811: remove test_config() redefinition
2013-03-19t4018,7810,7811: remove test_config() redefinitionLibravatar Ramkumar Ramachandra1-5/+0
test_config() is already a well-defined function in test-lib-functions.sh. Don't duplicate it unnecessarily. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16Add userdiff patterns for AdaLibravatar Adrian Johnson1-1/+1
Add Ada xfuncname and wordRegex patterns to the list of builtin patterns. Signed-off-by: Adrian Johnson <ajohnson@redneon.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-15Add built-in diff patterns for MATLAB codeLibravatar Gustaf Hendeby1-1/+1
MATLAB is often used in industry and academia for scientific computations motivating it being included as a built-in pattern. Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-23userdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimitersLibravatar Jonathan Nieder1-2/+15
A naive method of treating BEGIN/END blocks with a brace on the second line as diff/grep funcname context involves also matching unrelated lines that consist of all-caps letters: sub foo { print <<'EOF' text goes here ... EOF ... rest of foo ... } That's not so great, because it means that "git diff" and "git grep --show-function" would write "=EOF" or "@@ EOF" as context instead of a more useful reminder like "@@ sub foo {". To avoid this, tighten the pattern to only match the special block names that perl accepts (namely BEGIN, END, INIT, CHECK, UNITCHECK, AUTOLOAD, and DESTROY). The list is taken from perl's toke.c. Suggested-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21userdiff/perl: catch sub with brace on second lineLibravatar Jonathan Nieder1-2/+23
Accept sub foo { } as an alternative to a more common style that introduces perl functions with a brace on the first line (and likewise for BEGIN/END blocks). The new regex is a little hairy to avoid matching # forward declaration sub foo; while continuing to match "sub foo($;@) {" and sub foo { # This routine is interesting; # in fact, the lines below explain how... While at it, pay attention to Perl 5.14's "package foo {" syntax as an alternative to the traditional "package foo;". Requested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21userdiff/perl: match full line of POD headersLibravatar Jonathan Nieder1-0/+4
The builtin perl userdiff driver is not greedy enough about catching POD header lines. Capture the whole line, so instead of just declaring that we are in some "@@ =head1" section, diff/grep output can explain that the enclosing section is about "@@ =head1 OPTIONS". Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21userdiff/perl: anchor "sub" and "package" patterns on the leftLibravatar Jonathan Nieder1-3/+56
The userdiff funcname mechanism has no concept of nested scopes --- instead, "git diff" and "git grep --show-function" simply label the diff header with the most recent matching line. Unfortunately that means text following a subroutine in a POD section: =head1 DESCRIPTION You might use this facility like so: sub example { foo; } Now, having said that, let's say more about the facility. Blah blah blah ... etc etc. gets the subroutine name instead of the POD header in its diff/grep funcname header, making it harder to get oriented when reading a diff without enough context. The fix is simple: anchor the funcname syntax to the left margin so nested subroutines and packages like this won't get picked up. (The builtin C++ funcname pattern already does the same thing.) This means the userdiff driver will misparse the idiom { my $static; sub foo { ... use $static ... } } but I think that's worth it; we can revisit this later if the userdiff mechanism learns to keep track of the beginning and end of nested scopes. Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21t4018 (funcname patterns): minor cleanupsLibravatar Jonathan Nieder1-24/+25
Introduce a test_expect_funcname function to make a diff and apply a regexp anchored on the left to the function name it writes, avoiding some repetition. Omit the space after >, <<, and < operators for consistency with other scripts. Quote the <<here document delimiter and $ signs in quotes so readers don't have to worry about the effect of shell metacharacters. Remove some unnecessary blank lines. Run "git diff" as a separate command instead of as upstream of a pipe that checks its output, so the exit status can be tested. In particular, this way if "git diff" starts segfaulting the test harness will notice. Allow "error:" as a synonym for "fatal:" when checking error messages, since whether a command uses die() or "return error()" is a small implementation detail. Anchor some more regexes on the right. None of the above is very important on its own; the point is just to make the script a little easier to read and the code less scary to modify. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21t4018 (funcname patterns): make configuration easier to trackLibravatar Jonathan Nieder1-7/+12
Introduce a "test_config" function to set a configuration variable for use by a single test (automatically unsetting it when the assertion finishes). If this function is used consistently, the configuration used in a test_expect_success block can be read at the beginning of that block instead of requiring reading all the tests that come before. So it becomes a little easier to add new tests or rearrange existing ones without fear of breaking configuration. In particular, the test of alternation in xfuncname patterns also checks that xfuncname takes precedence over funcname variable as a sort of side-effect, since the latter leaks in from previous tests. In the new syntax, the test has to say explicitly what variables it is using, making the test clearer and a future regression in coverage from carelessly editing the script less likely. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21t4018 (funcname patterns): make .gitattributes state easier to trackLibravatar Jonathan Nieder1-2/+6
Most, but not all, tests in this script rely on attributes declaring that files with a .java extension should use the "java" driver: *.java diff=java Split out a "set up" test to put such a .gitattributes in place after the tests that do not want it have run, to make it more likely that individual tests other than this setup test can be safely modified, rearranged, or skipped. Presumably this setup code will learn to request other drivers for other extensions in the same place when the test suite learns to exercise other diff drivers. Similarly, make sure that early test assertions that do not use these default attributes set up .gitattributes appropriately for themselves, so tests that run before can be modified with less risk of breaking something. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-27diff: funcname and word patterns for perlLibravatar Jonathan Nieder1-1/+1
The default function name discovery already works quite well for Perl code... with the exception of here-documents (or rather their ending). sub foo { print <<END here-document END return 1; } The default funcname pattern treats the unindented END line as a function declaration and puts it in the @@ line of diff and "grep --show-function" output. With a little knowledge of perl syntax, we can do better. You can try it out by adding "*.perl diff=perl" to the gitattributes file. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-29Merge branch 'bc/fortran-userdiff'Libravatar Junio C Hamano1-1/+1
* bc/fortran-userdiff: userdiff.c: add builtin fortran regex patterns
2010-09-10userdiff.c: add builtin fortran regex patternsLibravatar Brandon Casey1-1/+1
This adds fortran xfuncname and wordRegex patterns to the list of builtin patterns. The intention is for the patterns to be appropriate for all versions of fortran including 77, 90, 95. The patterns can be enabled by adding the diff=fortran attribute to the .gitattributes file for the desired file glob. This also adds a new macro named IPATTERN which is just like the PATTERNS macro except it sets the REG_ICASE flag so that case will be ignored. The test code in t4018 and the docs were updated as appropriate. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-10t/t4018: avoid two unnecessary sub-shell invocationsLibravatar Brandon Casey1-4/+4
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09t/t4018: test whether the word_regex patterns compileLibravatar Brandon Casey1-0/+5
Previously (e3bf5e43), a test was added to test whether the builtin xfuncname regular expressions could be compiled without error by regcomp. Let's do the same for the word_regex patterns. This should help catch any cross-platform incompatibilities that exist between the pattern creator's system and the various platforms that the test suite is commonly run on. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-16Userdiff patterns for C#Libravatar Petr Onderka1-1/+1
Add userdiff patterns for C#. This code is an improved version of code by Adam Petaccia from 21 June 2009 mail to the list. Signed-off-by: Petr Onderka <gsvick@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-05t4018-diff-funcname: add cpp xfuncname pattern to syntax testLibravatar Brandon Casey1-1/+1
Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-17Merge branch 'maint'Libravatar Junio C Hamano1-1/+8
* maint: t1301-shared-repo.sh: don't let a default ACL interfere with the test git-check-attr(1): add output and example sections xdiff-interface.c: strip newline (and cr) from line before pattern matching t4018-diff-funcname: demonstrate end of line funcname matching flaw t4018-diff-funcname: rework negated last expression test Typo "does not exists" when git remote update remote. remote.c: correct the check for a leading '/' in a remote name Add testcase to ensure merging an early part of a branch is done properly Conflicts: t/t7600-merge.sh
2008-10-16xdiff-interface.c: strip newline (and cr) from line before pattern matchingLibravatar Brandon Casey1-1/+1
POSIX doth sayeth: "In the regular expression processing described in IEEE Std 1003.1-2001, the <newline> is regarded as an ordinary character and both a period and a non-matching list can match one. ... Those utilities (like grep) that do not allow <newline>s to match are responsible for eliminating any <newline> from strings before matching against the RE." Thus far git has not been removing the trailing newline from strings matched against regular expression patterns. This has the effect that (quoting Jonathan del Strother) "... a line containing just 'FUNCNAME' (terminated by a newline) will be matched by the pattern '^(FUNCNAME.$)' but not '^(FUNCNAME$)'", and more simply not '^FUNCNAME$'. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-16t4018-diff-funcname: demonstrate end of line funcname matching flawLibravatar Brandon Casey1-0/+6
Since the newline is not removed from lines before pattern matching, a pattern cannot match to the end of the line using the '$' operator without using an additional operator which will indirectly match the '\n' character. Introduce a test which should pass, but which does not due to this flaw. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-16t4018-diff-funcname: rework negated last expression testLibravatar Brandon Casey1-1/+2
This test used the non-zero exit status of 'git diff' to indicate that a negated funcname pattern, when placed last, was correctly rejected. The problem with this is that 'git diff' always returns non-zero if it finds differences in the files it is comparing, and the files must contain differences in order to trigger the funcname pattern codepath. Instead of checking for non-zero exit status, make sure the expected error message is printed. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-14t4018-diff-funcname: add objective-c xfuncname pattern to syntax testLibravatar Brandon Casey1-1/+1
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-23t4018-diff-funcname: test syntax of builtin xfuncname patternsLibravatar Brandon Casey1-1/+1
[jc: fixes bibtex pattern breakage exposed by this test] Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-22t4018-diff-funcname: test syntax of builtin xfuncname patternsLibravatar Brandon Casey1-0/+11
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-18diff.*.xfuncname which uses "extended" regex's for hunk header selectionLibravatar Brandon Casey1-1/+1
Currently, the hunk headers produced by 'diff -p' are customizable by setting the diff.*.funcname option in the config file. The 'funcname' option takes a basic regular expression. This functionality was designed using the GNU regex library which, by default, allows using backslashed versions of some extended regular expression operators, even in Basic Regular Expression mode. For example, the following characters, when backslashed, are interpreted according to the extended regular expression rules: ?, +, and |. As such, the builtin funcname patterns were created using some extended regular expression operators. Other platforms which adhere more strictly to the POSIX spec do not interpret the backslashed extended RE operators in Basic Regular Expression mode. This causes the pattern matching for the builtin funcname patterns to fail on those platforms. Introduce a new option 'xfuncname' which uses extended regular expressions, and advertise it _instead_ of funcname. Since most users are on GNU platforms, the majority of funcname patterns are created and tested there. Advertising only xfuncname should help to avoid the creation of non-portable patterns which work with GNU regex but not elsewhere. Additionally, the extended regular expressions may be less ugly and complicated compared to the basic RE since many common special operators do not need to be backslashed. For example, the GNU Basic RE: ^[ ]*\\(\\(public\\|static\\).*\\)$ becomes the following Extended RE: ^[ ]*((public|static).*)$ Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-10Use compatibility regex library for OSX/DarwinLibravatar Arjen Laarhoven1-0/+6
The standard libc regex library on OSX does not support alternation in POSIX Basic Regular Expression mode. This breaks the diff.funcname functionality on OSX. To fix this, we use the GNU regex library which is already present in the compat/ diretory for the MinGW port. However, simply adding compat/ to the COMPAT_CFLAGS variable causes a conflict between the system fnmatch.h and the one present in compat/. To remedy this, move the regex and fnmatch functionality to their own subdirectories in compat/ so they can be included seperately. Signed-off-by: Arjen Laarhoven <arjen@yaph.org> Tested-by: Mike Ralphson <mike@abacus.co.uk> (AIX) Tested-by: Johannes Sixt <johannes.sixt@telecom.at> (MinGW) Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13t/: Use "test_must_fail git" instead of "! git"Libravatar Stephan Beyer1-1/+1
This patch changes every occurrence of "! git" -- with the meaning that a git call has to gracefully fail -- into "test_must_fail git". This is useful to - make sure the test does not fail because of a signal, e.g. SIGSEGV, and - advertise the use of "test_must_fail" for new tests. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-24tests: do not use implicit "git diff --no-index"Libravatar Junio C Hamano1-4/+4
As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22Make test scripts executable.Libravatar Junio C Hamano1-0/+0