find:: get rid of nested function (it's a gcc-ism)
[oweals/busybox.git] / testsuite / ls.tests
index e08249ea601488f3662a322a2415916fbb65ced3..9309d366be105d440107d87fde393ee91b772a31 100755 (executable)
@@ -1,23 +1,23 @@
 #!/bin/sh
 # Copyright 2010 by Denys Vlasenko
-# Licensed under GPL v2, see file LICENSE for details.
+# Licensed under GPLv2, see file LICENSE in this source tree.
 
 . ./testing.sh
-
 test -f "$bindir/.config" && . "$bindir/.config"
 
-rm -rf ls.testdir >/dev/null
+rm -rf ls.testdir 2>/dev/null
 mkdir ls.testdir || exit 1
 
 # testing "test name" "command" "expected result" "file input" "stdin"
 
 # With Unicode provided by libc locale, I'm not sure this test can pass.
 # I suspect we might fail to skip exactly correct number of bytes
-# over broken unicode sequences.
-test x"$CONFIG_FEATURE_ASSUME_UNICODE" = x"y" \
-&& test x"$CONFIG_LOCALE_SUPPORT" != x"y" \
+# over broked unicode sequences.
+test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
+&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
 && test x"$CONFIG_SUBST_WCHAR" = x"63" \
 && test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"767" \
+&& test x"$CONFIG_FEATURE_LS_SORTFILES" = x"y" \
 && testing "ls unicode test with codepoints limited to 767" \
 "(cd ls.testdir && sh ../ls.mk_uni_tests) && ls -1 ls.testdir" \
 '0001_1__Some_correct_UTF-8_text___________________________________________|
@@ -133,8 +133,8 @@ test x"$CONFIG_FEATURE_ASSUME_UNICODE" = x"y" \
 ' "" ""
 
 # Currently fails on "0080_4.2.2__U-000007FF_=_e0_9f_bf" line
-test x"$CONFIG_FEATURE_ASSUME_UNICODE" = x"y" \
-&& test x"$CONFIG_LOCALE_SUPPORT" != x"y" \
+test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
+&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
 && test x"$CONFIG_SUBST_WCHAR" = x"63" \
 && test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"0" \
 && testing "ls unicode test with unlimited codepoints" \
@@ -144,7 +144,7 @@ test x"$CONFIG_FEATURE_ASSUME_UNICODE" = x"y" \
 0003_2.1__First_possible_sequence_of_a_certain_length_____________________|
 0004_2.1.2__2_bytes__U-00000080_:________"?"______________________________|
 0005_2.1.3__3_bytes__U-00000800_:________"ࠀ"______________________________|
-0006_2.1.4__4_bytes__U-00010000_:________"?"______________________________|
+0006_2.1.4__4_bytes__U-00010000_:________"𐀀"______________________________|
 0007_2.1.5__5_bytes__U-00200000_:________"?"______________________________|
 0008_2.1.6__6_bytes__U-04000000_:________"?"______________________________|
 0009_2.2__Last_possible_sequence_of_a_certain_length______________________|
@@ -155,9 +155,9 @@ test x"$CONFIG_FEATURE_ASSUME_UNICODE" = x"y" \
 0014_2.2.5__5_bytes__U-03FFFFFF_:________"?"______________________________|
 0015_2.2.6__6_bytes__U-7FFFFFFF_:________"?"______________________________|
 0016_2.3__Other_boundary_conditions_______________________________________|
-0017_2.3.1__U-0000D7FF_=_ed_9f_bf_=_"?"___________________________________|
+0017_2.3.1__U-0000D7FF_=_ed_9f_bf_=_""___________________________________|
 0018_2.3.2__U-0000E000_=_ee_80_80_=_"?"___________________________________|
-0019_2.3.3__U-0000FFFD_=_ef_bf_bd_=_"?"___________________________________|
+0019_2.3.3__U-0000FFFD_=_ef_bf_bd_=_""___________________________________|
 0020_2.3.4__U-0010FFFF_=_f4_8f_bf_bf_=_"?"________________________________|
 0021_2.3.5__U-00110000_=_f4_90_80_80_=_"?"________________________________|
 0022_3__Malformed_sequences_______________________________________________|
@@ -251,6 +251,17 @@ test x"$CONFIG_FEATURE_ASSUME_UNICODE" = x"y" \
 0110_5.3.2__U+FFFF_=_ef_bf_bf_=_"?"_______________________________________|
 ' "" ""
 
+rm -rf ls.testdir 2>/dev/null
+mkdir ls.testdir || exit 1
+
+# testing "test name" "command" "expected result" "file input" "stdin"
+
+test x"$CONFIG_FEATURE_LS_SORTFILES" = x"y" \
+&& testing "ls symlink_to_dir" \
+"touch ls.testdir/A ls.testdir/B; ln -s ls.testdir ls.link; ls ls.link; ls -1 ls.link/; ls -1 ls.link; rm -f ls.link" \
+"A\nB\nA\nB\nA\nB\n" \
+"" ""
+
 # Clean up
 rm -rf ls.testdir 2>/dev/null