Skip to content

Commit

Permalink
t0003: remove extra whitespaces
Browse files Browse the repository at this point in the history
The test had excess whitespaces everywhere that made it harder to
read than necessary. Remove them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Sep 22, 2011
1 parent b2b3e9c commit 78cec75
Showing 1 changed file with 22 additions and 46 deletions.
68 changes: 22 additions & 46 deletions t/t0003-attributes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ test_description=gitattributes
. ./test-lib.sh

attr_check () {

path="$1"
expect="$2"
path="$1" expect="$2"

git check-attr test -- "$path" >actual 2>err &&
echo "$path: test: $2" >expect &&
test_cmp expect actual &&
test_line_count = 0 err

}


test_expect_success 'setup' '
mkdir -p a/b/d a/c b &&
(
echo "[attr]notest !test"
Expand All @@ -40,29 +36,27 @@ test_expect_success 'setup' '
(
echo "global test=global"
) >"$HOME"/global-gitattributes &&
cat <<EOF >expect-all
f: test: f
a/f: test: f
a/c/f: test: f
a/g: test: a/g
a/b/g: test: a/b/g
b/g: test: unspecified
a/b/h: test: a/b/h
a/b/d/g: test: a/b/d/*
onoff: test: unset
offon: test: set
no: notest: set
no: test: unspecified
a/b/d/no: notest: set
a/b/d/no: test: a/b/d/*
a/b/d/yes: notest: set
a/b/d/yes: test: unspecified
EOF
cat <<-EOF >expect-all
f: test: f
a/f: test: f
a/c/f: test: f
a/g: test: a/g
a/b/g: test: a/b/g
b/g: test: unspecified
a/b/h: test: a/b/h
a/b/d/g: test: a/b/d/*
onoff: test: unset
offon: test: set
no: notest: set
no: test: unspecified
a/b/d/no: notest: set
a/b/d/no: test: a/b/d/*
a/b/d/yes: notest: set
a/b/d/yes: test: unspecified
EOF
'

test_expect_success 'command line checks' '
test_must_fail git check-attr &&
test_must_fail git check-attr -- &&
test_must_fail git check-attr test &&
Expand All @@ -72,11 +66,9 @@ test_expect_success 'command line checks' '
echo "f" | test_must_fail git check-attr --stdin -- f &&
echo "f" | test_must_fail git check-attr --stdin test -- f &&
test_must_fail git check-attr "" -- f
'

test_expect_success 'attribute test' '
attr_check f f &&
attr_check a/f f &&
attr_check a/c/f f &&
Expand All @@ -90,20 +82,16 @@ test_expect_success 'attribute test' '
attr_check no unspecified &&
attr_check a/b/d/no "a/b/d/*" &&
attr_check a/b/d/yes unspecified
'

test_expect_success 'unnormalized paths' '
attr_check ./f f &&
attr_check ./a/g a/g &&
attr_check a/./g a/g &&
attr_check a/c/../b/g a/b/g
'

test_expect_success 'relative paths' '
(cd a && attr_check ../f f) &&
(cd a && attr_check f f) &&
(cd a && attr_check i a/i) &&
Expand All @@ -112,7 +100,6 @@ test_expect_success 'relative paths' '
(cd b && attr_check ../a/f f) &&
(cd b && attr_check ../a/g a/g) &&
(cd b && attr_check ../a/b/g a/b/g)
'

test_expect_success 'core.attributesfile' '
Expand All @@ -121,27 +108,24 @@ test_expect_success 'core.attributesfile' '
attr_check global global &&
git config core.attributesfile "~/global-gitattributes" &&
attr_check global global &&
echo "global test=precedence" >> .gitattributes &&
echo "global test=precedence" >>.gitattributes &&
attr_check global precedence
'

test_expect_success 'attribute test: read paths from stdin' '
grep -v notest < expect-all > expect &&
sed -e "s/:.*//" < expect | git check-attr --stdin test > actual &&
grep -v notest <expect-all >expect &&
sed -e "s/:.*//" <expect | git check-attr --stdin test >actual &&
test_cmp expect actual
'

test_expect_success 'attribute test: --all option' '
grep -v unspecified <expect-all | sort >specified-all &&
sed -e "s/:.*//" <expect-all | uniq >stdin-all &&
git check-attr --stdin --all <stdin-all | sort >actual &&
test_cmp specified-all actual
'

test_expect_success 'attribute test: --cached option' '
: >empty &&
git check-attr --cached --stdin --all <stdin-all | sort >actual &&
test_cmp empty actual &&
Expand All @@ -151,21 +135,16 @@ test_expect_success 'attribute test: --cached option' '
'

test_expect_success 'root subdir attribute test' '
attr_check a/i a/i &&
attr_check subdir/a/i unspecified
'

test_expect_success 'setup bare' '
git clone --bare . bare.git &&
cd bare.git
'

test_expect_success 'bare repository: check that .gitattribute is ignored' '
(
echo "f test=f"
echo "a/i test=a/i"
Expand All @@ -175,7 +154,6 @@ test_expect_success 'bare repository: check that .gitattribute is ignored' '
attr_check a/c/f unspecified &&
attr_check a/i unspecified &&
attr_check subdir/a/i unspecified
'

test_expect_success 'bare repository: check that --cached honors index' '
Expand All @@ -186,7 +164,6 @@ test_expect_success 'bare repository: check that --cached honors index' '
'

test_expect_success 'bare repository: test info/attributes' '
(
echo "f test=f"
echo "a/i test=a/i"
Expand All @@ -196,7 +173,6 @@ test_expect_success 'bare repository: test info/attributes' '
attr_check a/c/f f &&
attr_check a/i a/i &&
attr_check subdir/a/i unspecified
'

test_done

0 comments on commit 78cec75

Please sign in to comment.