From 8a3b25da8cdd7f3aa75f18d3245ce83aca90bb1a Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 7 Mar 2009 20:22:07 -0500 Subject: t3000: use test_cmp instead of diff These ancient tests predate test_cmp. While we're at it, let's switch to our usual "expected before actual" order of arguments; this makes the diff output "here's what is changed from expected" instead of the reverse. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t3000-ls-files-others.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/t3000-ls-files-others.sh') diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh index bc0a351392..36eee0f8ae 100755 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh @@ -42,7 +42,7 @@ test_expect_success \ test_expect_success \ 'git ls-files --others should pick up symlinks.' \ - 'diff output expected1' + 'test_cmp expected1 output' test_expect_success \ 'git ls-files --others --directory to show output.' \ @@ -51,6 +51,6 @@ test_expect_success \ test_expect_success \ 'git ls-files --others --directory should not get confused.' \ - 'diff output expected2' + 'test_cmp expected2 output' test_done -- cgit v1.2.3 From 2fb6d6d6dd1033bfe82d6d327ac270f9cf8943cd Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 7 Mar 2009 20:27:22 -0500 Subject: ls-files: fix broken --no-empty-directory Commit ce8e880 converted ls-files to use parseopt; the --no-empty-directory option was converted as an OPT_BIT for "empty-directory" to set the DIR_HIDE_EMPTY_DIRECTORY flag. However, that makes it do the opposite of what it should: --empty-directory would hide, but --no-empty-directory would turn off hiding. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t3000-ls-files-others.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 't/t3000-ls-files-others.sh') diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh index 36eee0f8ae..379d963cea 100755 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh @@ -13,12 +13,13 @@ filesystem. path2/file2 - a file in a directory path3-junk - a file to confuse things path3/file3 - a file in a directory + path4 - an empty directory ' . ./test-lib.sh date >path0 ln -s xyzzy path1 -mkdir path2 path3 +mkdir path2 path3 path4 date >path2/file2 date >path2-junk date >path3/file3 @@ -28,6 +29,7 @@ git update-index --add path3-junk path3/file3 cat >expected1 <expected2 +cat expected3 +echo path4/ >>expected2 test_expect_success \ 'git ls-files --others to show output.' \ @@ -53,4 +57,12 @@ test_expect_success \ 'git ls-files --others --directory should not get confused.' \ 'test_cmp expected2 output' +test_expect_success \ + 'git ls-files --others --directory --no-empty-directory to show output.' \ + 'git ls-files --others --directory --no-empty-directory >output' + +test_expect_success \ + '--no-empty-directory hides empty directory' \ + 'test_cmp expected3 output' + test_done -- cgit v1.2.3 From 188c3827c10f5a04588ef7af8b63a7b5dbcc38ed Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 16 Mar 2009 21:18:42 +0100 Subject: Tests: use test_cmp instead of diff where possible Several old tests were written before test_cmp was introduced, convert these to test_cmp. If were are at it, fix the order of the arguments where necessary to make expected come first, so the command shows how the test result deviates from the correct output. Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- t/t3000-ls-files-others.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/t3000-ls-files-others.sh') diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh index bc0a351392..36eee0f8ae 100755 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh @@ -42,7 +42,7 @@ test_expect_success \ test_expect_success \ 'git ls-files --others should pick up symlinks.' \ - 'diff output expected1' + 'test_cmp expected1 output' test_expect_success \ 'git ls-files --others --directory to show output.' \ @@ -51,6 +51,6 @@ test_expect_success \ test_expect_success \ 'git ls-files --others --directory should not get confused.' \ - 'diff output expected2' + 'test_cmp expected2 output' test_done -- cgit v1.2.3 From 704a3143d5ba0709727430154ef3dad600aad4de Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 4 Mar 2009 22:38:24 +0100 Subject: Use prerequisite tags to skip tests that depend on symbolic links Many tests depend on that symbolic links work. This introduces a check that sets the prerequisite tag SYMLINKS if the file system supports symbolic links. Since so many tests have to check for this prerequisite, we do the check in test-lib.sh, so that we don't need to repeat the test in many scripts. To check for 'ln -s' failures, you can use a FAT partition on Linux: $ mkdosfs -C git-on-fat 1000000 $ sudo mount -o loop,uid=j6t,gid=users,shortname=winnt git-on-fat /mnt Clone git to /mnt and $ GIT_SKIP_TESTS='t0001.1[34] t0010 t1301 t403[34] t4129.[47] t5701.7 t7701.3 t9100 t9101.26 t9119 t9124.[67] t9200.10 t9600.6' \ make test (These additionally skipped tests depend on POSIX permissions that FAT on Linux does not provide.) Signed-off-by: Johannes Sixt --- t/t3000-ls-files-others.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 't/t3000-ls-files-others.sh') diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh index 36eee0f8ae..b7e0306316 100755 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh @@ -17,7 +17,12 @@ filesystem. . ./test-lib.sh date >path0 -ln -s xyzzy path1 +if test_have_prereq SYMLINKS +then + ln -s xyzzy path1 +else + date > path1 +fi mkdir path2 path3 date >path2/file2 date >path2-junk -- cgit v1.2.3