svn commit: r288478 - user/ngie/more-tests/bin/ls/tests

Garrett Cooper ngie at FreeBSD.org
Fri Oct 2 07:06:27 UTC 2015


Author: ngie
Date: Fri Oct  2 07:06:26 2015
New Revision: 288478
URL: https://svnweb.freebsd.org/changeset/base/288478

Log:
  Add testcases for ls -u

Modified:
  user/ngie/more-tests/bin/ls/tests/ls_tests.sh

Modified: user/ngie/more-tests/bin/ls/tests/ls_tests.sh
==============================================================================
--- user/ngie/more-tests/bin/ls/tests/ls_tests.sh	Fri Oct  2 07:00:43 2015	(r288477)
+++ user/ngie/more-tests/bin/ls/tests/ls_tests.sh	Fri Oct  2 07:06:26 2015	(r288478)
@@ -304,6 +304,32 @@ q_flag_and_w_flag_body()
 	atf_check -e empty -o match:"$test_file" -s exit:0 ls -w "$test_file"
 }
 
+u_flag_head()
+{
+	atf_set "descr" "Verify that the output from ls -u sorts by last access with -l and -t"
+}
+
+u_flag_body()
+{
+	create_test_dir
+
+	atf_check -e empty -o empty -s exit:0 touch a.file
+	sleep 0.3
+	atf_check -e empty -o empty -s exit:0 touch b.file
+	sleep 0.3
+
+	atf_check -e empty -o match:'b\.file' -s exit:0 sh -c 'ls -lu | tail -n 1'
+	atf_check -e empty -o match:'a\.file.*b\.file' -s exit:0 ls -Cu
+
+	atf_check -e empty -o empty -s exit:0 sh -c 'echo "i am a" > a.file'
+	sleep 0.3
+	atf_check -e empty -o match:'i am a' -s exit:0 cat a.file
+	sleep 0.3
+
+	atf_check -e empty -o match:'b\.file' -s exit:0 sh -c 'ls -lu | tail -n 1'
+	atf_check -e empty -o match:'a\.file.*b\.file' -s exit:0 ls -Cu
+}
+
 x_flag_head()
 {
 	atf_set "descr" "Verify that the output from ls -x is multi-column, sorted across"
@@ -412,7 +438,7 @@ atf_init_test_cases()
 	#atf_add_test_case r_flag
 	#atf_add_test_case s_flag
 	#atf_add_test_case t_flag
-	#atf_add_test_case u_flag
+	atf_add_test_case u_flag
 	atf_add_test_case x_flag
 	atf_add_test_case y_flag
 	atf_add_test_case 1_flag


More information about the svn-src-user mailing list