t: use test_expect_code instead of hand-rolled comparison
[gitweb.git] / t / t8003-blame-corner-cases.sh
index 230143cf318705fb01e61f10072a096e86186934..32895e5acba8d246539d3bd97fe7305827f18aa7 100755 (executable)
@@ -26,7 +26,7 @@ test_expect_success setup '
        cat one >uno &&
        mv two dos &&
        cat one >>tres &&
-       echo DEF >>mouse
+       echo DEF >>mouse &&
        git add uno dos tres mouse &&
        test_tick &&
        GIT_AUTHOR_NAME=Second git commit -a -m Second &&
@@ -153,15 +153,15 @@ test_expect_success 'blame path that used to be a directory' '
 '
 
 test_expect_success 'blame to a commit with no author name' '
-  TREE=`git rev-parse HEAD:`
-  cat >badcommit <<EOF
+  TREE=`git rev-parse HEAD:` &&
+  cat >badcommit <<EOF &&
 tree $TREE
 author <noname> 1234567890 +0000
 committer David Reiss <dreiss@facebook.com> 1234567890 +0000
 
 some message
 EOF
-  COMMIT=`git hash-object -t commit -w badcommit`
+  COMMIT=`git hash-object -t commit -w badcommit` &&
   git --no-pager blame $COMMIT -- uno >/dev/null
 '
 
@@ -175,6 +175,12 @@ test_expect_success 'blame -L with invalid end' '
        grep "has only 2 lines" errors
 '
 
+test_expect_success 'blame parses <end> part of -L' '
+       git blame -L1,1 tres >out &&
+       cat out &&
+       test $(wc -l < out) -eq 1
+'
+
 test_expect_success 'indent of line numbers, nine lines' '
        git blame nine_lines >actual &&
        test $(grep -c "  " actual) = 0
@@ -185,4 +191,13 @@ test_expect_success 'indent of line numbers, ten lines' '
        test $(grep -c "  " actual) = 9
 '
 
+test_expect_success 'blaming files with CRLF newlines' '
+       git config core.autocrlf false &&
+       printf "testcase\r\n" >crlffile &&
+       git add crlffile &&
+       git commit -m testcase &&
+       git -c core.autocrlf=input blame crlffile >actual &&
+       grep "A U Thor" actual
+'
+
 test_done