]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t0030-stripspace.sh
The eighth batch
[thirdparty/git.git] / t / t0030-stripspace.sh
index d1b3be872576789541410fa66d4473a006db99b2..f10f42ff1e4a8716609a1e8dd86e1441e020db3d 100755 (executable)
@@ -401,6 +401,21 @@ test_expect_success 'strip comments with changed comment char' '
        test -z "$(echo "; comment" | git -c core.commentchar=";" stripspace -s)"
 '
 
+test_expect_success 'strip comments with changed comment string' '
+       test ! -z "$(echo "// comment" | git -c core.commentchar=// stripspace)" &&
+       test -z "$(echo "// comment" | git -c core.commentchar="//" stripspace -s)"
+'
+
+test_expect_success 'newline as commentchar is forbidden' '
+       test_must_fail git -c core.commentChar="$LF" stripspace -s 2>err &&
+       grep "core.commentchar cannot contain newline" err
+'
+
+test_expect_success 'empty commentchar is forbidden' '
+       test_must_fail git -c core.commentchar= stripspace -s 2>err &&
+       grep "core.commentchar must have at least one character" err
+'
+
 test_expect_success '-c with single line' '
        printf "# foo\n" >expect &&
        printf "foo" | git stripspace -c >actual &&