commit 16357e96dcfbf9a5d2b1ab2347c04b25a17c4993 from: Stefan Sperling date: Mon Aug 19 11:17:26 2019 UTC add another xfail blame test case commit - b24db1c106cc7d53cf2931a1d0898b95d1d058ed commit + 16357e96dcfbf9a5d2b1ab2347c04b25a17c4993 blob - c34f7676e910c0441ee471180dfdcd5af119d970 blob + 7ad08ea695569ef87b08505a096a53947d72ad92 --- regress/cmdline/blame.sh +++ regress/cmdline/blame.sh @@ -19,6 +19,7 @@ function blame_cmp { local testroot="$1" local file="$2" + local xfail="$3" (cd $testroot/wt && got blame "$file" | cut -d ' ' -f 2 \ > $testroot/${file}.blame.got) @@ -28,11 +29,11 @@ function blame_cmp { cmp -s $testroot/${file}.blame.git $testroot/${file}.blame.got ret="$?" - if [ "$ret" != "0" ]; then + if [ "$ret" != "0" -a "$xfail" == "" ]; then diff -u $testroot/${file}.blame.git $testroot/${file}.blame.got return 1 fi - return 0 + return "$ret" } function test_blame_basic { @@ -532,7 +533,155 @@ EOF fi blame_cmp "$testroot" "alpha" + ret="$?" + test_done "$testroot" "$ret" +} + +function test_blame_blame_h { + local testroot=`test_init blame_blame_h` + + got checkout $testroot/repo $testroot/wt > /dev/null + ret="$?" + if [ "$ret" != "0" ]; then + test_done "$testroot" "$ret" + return 1 + fi + + cat > $testroot/wt/got_blame.h < + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +const struct got_error *got_blame(const char *, struct got_object_id *, + struct got_repository *, FILE *); +EOF + (cd $testroot/wt && got add got_blame.h > /dev/null) + (cd $testroot/wt && got commit -m "change 1" > /dev/null) + + cat > $testroot/wt/blame-2.patch < /dev/null) + (cd $testroot/wt && got commit -m "change 2" > /dev/null) + + cat > $testroot/wt/blame-3.patch < /dev/null) + (cd $testroot/wt && got commit -m "change 3" > /dev/null) + + cat > $testroot/wt/blame-4.patch < /dev/null) + (cd $testroot/wt && got commit -m "change 4" > /dev/null) + + cat > $testroot/wt/blame-5.patch < /dev/null) + (cd $testroot/wt && got commit -m "change 5" > /dev/null) + + blame_cmp "$testroot" "got_blame.h" xfail ret="$?" + if [ "$ret" != 0 ]; then + test_done "$testroot" "xfail: lines 12, 13, 16 wrongly annotated" + return 1 + fi test_done "$testroot" "$ret" } @@ -544,3 +693,4 @@ run_test test_blame_all_lines_replaced run_test test_blame_lines_shifted_up run_test test_blame_lines_shifted_down run_test test_blame_commit_subsumed +run_test test_blame_blame_h