[m-rev.] trivial diff: fix dir_test failure

Simon Taylor stayl at cs.mu.OZ.AU
Tue Jul 29 01:50:29 AEST 2003


Estimated hours taken: 1
Branches: main

tests/hard_coded/dir_test.{m,exp,exp2,exp3}:
	Fix formatting of output.
	Fix expected output.

Index: dir_test.exp
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/dir_test.exp,v
retrieving revision 1.1
diff -u -u -r1.1 dir_test.exp
--- dir_test.exp	21 Jul 2003 14:08:42 -0000	1.1
+++ dir_test.exp	28 Jul 2003 15:45:44 -0000
@@ -1,6 +1,6 @@
 Directory separator is '\'.
 dir__split_name("\\server\share\foo", "\\server\share", "foo").
-""\\server\share"/"foo"  = "\\server\share\foo".
+"\\server\share"/"foo" = "\\server\share\foo".
 dir__dirname("\\server\share\foo") = "\\server\share".
 dir__basename("\\server\share\foo") = "foo".
 dir__path_name_is_absolute("\\server\share\foo").
@@ -19,14 +19,14 @@
 dir__path_name_is_root_directory("\\server\share\\").
 
 dir__split_name("C:\foo", "C:\", "foo").
-""C:\"/"foo"  = "C:\foo".
+"C:\"/"foo" = "C:\foo".
 dir__dirname("C:\foo") = "C:\".
 dir__basename("C:\foo") = "foo".
 dir__path_name_is_absolute("C:\foo").
 dir__path_name_is_root_directory("C:\foo") failed
 
 dir__split_name("C:\foo\", "C:\", "foo").
-""C:\"/"foo"  = "C:\foo".
+"C:\"/"foo" = "C:\foo".
 dir__dirname("C:\foo\") = "C:\".
 dir__basename("C:\foo\") = "foo".
 dir__path_name_is_absolute("C:\foo\").
@@ -57,14 +57,14 @@
 dir__path_name_is_root_directory("") failed
 
 dir__split_name("foo\\bar\", "foo", "bar").
-""foo"/"bar"  = "foo\bar".
+"foo"/"bar" = "foo\bar".
 dir__dirname("foo\\bar\") = "foo".
 dir__basename("foo\\bar\") = "bar".
 dir__path_name_is_absolute("foo\\bar\") failed
 dir__path_name_is_root_directory("foo\\bar\") failed
 
 dir__split_name("foo\bar\", "foo", "bar").
-""foo"/"bar"  = "foo\bar".
+"foo"/"bar" = "foo\bar".
 dir__dirname("foo\bar\") = "foo".
 dir__basename("foo\bar\") = "bar".
 dir__path_name_is_absolute("foo\bar\") failed
@@ -77,14 +77,14 @@
 dir__path_name_is_root_directory("foo") failed
 
 dir__split_name("/foo", "\", "foo").
-""\"/"foo"  = "\foo".
+"\"/"foo" = "\foo".
 dir__dirname("/foo") = "\".
 dir__basename("/foo") = "foo".
 dir__path_name_is_absolute("/foo").
 dir__path_name_is_root_directory("/foo") failed
 
 dir__split_name("/foo//bar///", "\foo", "bar").
-""\foo"/"bar"  = "\foo\bar".
+"\foo"/"bar" = "\foo\bar".
 dir__dirname("/foo//bar///") = "\foo".
 dir__basename("/foo//bar///") = "bar".
 dir__path_name_is_absolute("/foo//bar///").
@@ -115,20 +115,20 @@
 dir__path_name_is_root_directory("//").
 
 dir__split_name("foo/bar", "foo", "bar").
-""foo"/"bar"  = "foo\bar".
+"foo"/"bar" = "foo\bar".
 dir__dirname("foo/bar") = "foo".
 dir__basename("foo/bar") = "bar".
 dir__path_name_is_absolute("foo/bar") failed
 dir__path_name_is_root_directory("foo/bar") failed
 
-"C:"/"foo"  = "C:foo".
-"C:\"/"foo"  = "C:\foo".
+"C:"/"foo" = "C:foo".
+"C:\"/"foo" = "C:\foo".
 "C:"/"C:" threw exception: software_error("dir./: second argument is a current drive relative path")
 "C:"/"C:\foo" threw exception: software_error("dir./: second argument is absolute")
 "."/"/foo" threw exception: software_error("dir./: second argument is absolute")
 "."/"\foo" threw exception: software_error("dir./: second argument is absolute")
-"foo"/"bar/baz"  = "foo\bar\baz".
-"foo/"/"bar/baz"  = "foo\bar\baz".
+"foo"/"bar/baz" = "foo\bar\baz".
+"foo/"/"bar/baz" = "foo\bar\baz".
 checking whether `unwritable' is readable...ok
 unwritable file found to be unwritable
 make_directory succeeded
@@ -151,8 +151,8 @@
 test_dir\d1, test_dir\d2, test_dir\quark, test_dir\queeg
 dir__recursive_foldl2 (no symlinks) succeeded
 Files in test_dir (recursive, not following symlinks):
-test_dir\d1, test_dir\d1\foo, test_dir\d1\baz, test_dir\d2, test_dir\d2\d2, test_dir\quark, test_dir\queeg
+test_dir\d1, test_dir\d1\baz, test_dir\d1\foo, test_dir\d2, test_dir\d2\d2, test_dir\quark, test_dir\queeg
 dir__recursive_foldl2 (symlinks) succeeded
 Files in test_dir (recursive, following symlinks:
-test_dir\d1, test_dir\d1\foo, test_dir\d1\baz, test_dir\d2, test_dir\d2\d2, test_dir\quark, test_dir\queeg
+test_dir\d1, test_dir\d1\baz, test_dir\d1\foo, test_dir\d2, test_dir\d2\d2, test_dir\quark, test_dir\queeg
 dir.recursive_foldl2(list_files, "dir_test.m", ...) failed as expected.
Index: dir_test.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/dir_test.exp2,v
retrieving revision 1.1
diff -u -u -r1.1 dir_test.exp2
--- dir_test.exp2	21 Jul 2003 14:08:42 -0000	1.1
+++ dir_test.exp2	28 Jul 2003 15:48:05 -0000
@@ -72,28 +72,28 @@
 dir__path_name_is_root_directory("foo") failed
 
 dir__split_name("/foo", "/", "foo").
-"/"/"foo"  = "/foo".
+"/"/"foo" = "/foo".
 dir__dirname("/foo") = "/".
 dir__basename("/foo") = "foo".
 dir__path_name_is_absolute("/foo").
 dir__path_name_is_root_directory("/foo") failed
 
 dir__split_name("/foo//bar///", "/foo", "bar").
-"/foo"/"bar"  = "/foo/bar".
+"/foo"/"bar" = "/foo/bar".
 dir__dirname("/foo//bar///") = "/foo".
 dir__basename("/foo//bar///") = "bar".
 dir__path_name_is_absolute("/foo//bar///").
 dir__path_name_is_root_directory("/foo//bar///") failed
 
 dir__split_name("//foo//bar/", "/foo", "bar").
-"/foo"/"bar"  = "/foo/bar".
+"/foo"/"bar" = "/foo/bar".
 dir__dirname("//foo//bar/") = "/foo".
 dir__basename("//foo//bar/") = "bar".
 dir__path_name_is_absolute("//foo//bar/").
 dir__path_name_is_root_directory("//foo//bar/") failed
 
 dir__split_name("//foo//", "/", "foo").
-"/"/"foo"  = "/foo".
+"/"/"foo" = "/foo".
 dir__dirname("//foo//") = "/".
 dir__basename("//foo//") = "foo".
 dir__path_name_is_absolute("//foo//").
@@ -112,20 +112,20 @@
 dir__path_name_is_root_directory("//").
 
 dir__split_name("foo/bar", "foo", "bar").
-"foo"/"bar"  = "foo/bar".
+"foo"/"bar" = "foo/bar".
 dir__dirname("foo/bar") = "foo".
 dir__basename("foo/bar") = "bar".
 dir__path_name_is_absolute("foo/bar") failed
 dir__path_name_is_root_directory("foo/bar") failed
 
-C:"/"foo"  = "C:/foo".
-C:\"/"foo"  = "C:\/foo".
-C:"/"C:"  = "C:/C:".
-C:"/"C:\foo"  = "C:/C:\foo".
-."/"/foo" threw exception: software_error("dir./: second argument is absolute")
-."/"\foo"  = "./\foo".
-foo"/"bar/baz"  = "foo/bar/baz".
-foo/"/"bar/baz"  = "foo/bar/baz".
+"C:"/"foo" = "C:/foo".
+"C:\"/"foo" = "C:\/foo".
+"C:"/"C:" = "C:/C:".
+"C:"/"C:\foo" = "C:/C:\foo".
+"."/"/foo" threw exception: software_error("dir./: second argument is absolute")
+"."/"\foo" = "./\foo".
+"foo"/"bar/baz" = "foo/bar/baz".
+"foo/"/"bar/baz" = "foo/bar/baz".
 checking whether `unwritable' is readable...ok
 unwritable file found to be unwritable
 make_directory succeeded
@@ -157,5 +157,5 @@
 test_dir/d1, test_dir/d1/bar, test_dir/d1/baz, test_dir/d1/foo, test_dir/d1/parent, test_dir/d2, test_dir/d2/d2, test_dir/d3, test_dir/quark, test_dir/queeg
 dir__recursive_foldl2 (symlinks) succeeded
 Files in test_dir (recursive, following symlinks:
-test_dir/d1, test_dir/d1/bar, test_dir/d1/baz, test_dir/d1/foo, test_dir/d1/parent, test_dir/d2, test_dir/d2/d2, test_dir/d3, test_dir/d3/bar, test_dir/d3/baz, test_dir/d3/foo, test_dir/d3/parent, test_dir/quark, test_dir/queeg
+test_dir/d1, test_dir/d1/bar, test_dir/d1/baz, test_dir/d1/foo, test_dir/d1/parent, test_dir/d2, test_dir/d2/d2, test_dir/d3, test_dir/quark, test_dir/queeg
 dir.recursive_foldl2(list_files, "dir_test.m", ...) failed as expected.
Index: dir_test.exp3
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/dir_test.exp3,v
retrieving revision 1.1
diff -u -u -r1.1 dir_test.exp3
--- dir_test.exp3	24 Jul 2003 03:02:38 -0000	1.1
+++ dir_test.exp3	28 Jul 2003 15:45:44 -0000
@@ -1,6 +1,6 @@
 Directory separator is '/'.
 dir__split_name("\\server\share\foo", "\\server\share", "foo").
-""\\server\share"/"foo"  = "\\server\share/foo".
+"\\server\share"/"foo" = "\\server\share/foo".
 dir__dirname("\\server\share\foo") = "\\server\share".
 dir__basename("\\server\share\foo") = "foo".
 dir__path_name_is_absolute("\\server\share\foo").
@@ -19,14 +19,14 @@
 dir__path_name_is_root_directory("\\server\share\\").
 
 dir__split_name("C:\foo", "C:\", "foo").
-""C:\"/"foo"  = "C:\foo".
+"C:\"/"foo" = "C:\foo".
 dir__dirname("C:\foo") = "C:\".
 dir__basename("C:\foo") = "foo".
 dir__path_name_is_absolute("C:\foo").
 dir__path_name_is_root_directory("C:\foo") failed
 
 dir__split_name("C:\foo\", "C:\", "foo").
-""C:\"/"foo"  = "C:\foo".
+"C:\"/"foo" = "C:\foo".
 dir__dirname("C:\foo\") = "C:\".
 dir__basename("C:\foo\") = "foo".
 dir__path_name_is_absolute("C:\foo\").
@@ -57,14 +57,14 @@
 dir__path_name_is_root_directory("") failed
 
 dir__split_name("foo\\bar\", "foo", "bar").
-""foo"/"bar"  = "foo/bar".
+"foo"/"bar" = "foo/bar".
 dir__dirname("foo\\bar\") = "foo".
 dir__basename("foo\\bar\") = "bar".
 dir__path_name_is_absolute("foo\\bar\") failed
 dir__path_name_is_root_directory("foo\\bar\") failed
 
 dir__split_name("foo\bar\", "foo", "bar").
-""foo"/"bar"  = "foo/bar".
+"foo"/"bar" = "foo/bar".
 dir__dirname("foo\bar\") = "foo".
 dir__basename("foo\bar\") = "bar".
 dir__path_name_is_absolute("foo\bar\") failed
@@ -77,14 +77,14 @@
 dir__path_name_is_root_directory("foo") failed
 
 dir__split_name("/foo", "/", "foo").
-""/"/"foo"  = "/foo".
+"/"/"foo" = "/foo".
 dir__dirname("/foo") = "/".
 dir__basename("/foo") = "foo".
 dir__path_name_is_absolute("/foo").
 dir__path_name_is_root_directory("/foo") failed
 
 dir__split_name("/foo//bar///", "/foo", "bar").
-""/foo"/"bar"  = "/foo/bar".
+"/foo"/"bar" = "/foo/bar".
 dir__dirname("/foo//bar///") = "/foo".
 dir__basename("/foo//bar///") = "bar".
 dir__path_name_is_absolute("/foo//bar///").
@@ -115,20 +115,20 @@
 dir__path_name_is_root_directory("//").
 
 dir__split_name("foo/bar", "foo", "bar").
-""foo"/"bar"  = "foo/bar".
+"foo"/"bar" = "foo/bar".
 dir__dirname("foo/bar") = "foo".
 dir__basename("foo/bar") = "bar".
 dir__path_name_is_absolute("foo/bar") failed
 dir__path_name_is_root_directory("foo/bar") failed
 
-"C:"/"foo"  = "C:/foo".
-"C:\"/"foo"  = "C:\foo".
-"C:"/"C:"  = "C:/C:".
+"C:"/"foo" = "C:/foo".
+"C:\"/"foo" = "C:\foo".
+"C:"/"C:" = "C:/C:".
 "C:"/"C:\foo" threw exception: software_error("dir./: second argument is absolute")
 "."/"/foo" threw exception: software_error("dir./: second argument is absolute")
 "."/"\foo" threw exception: software_error("dir./: second argument is absolute")
-"foo"/"bar/baz"  = "foo/bar/baz".
-"foo/"/"bar/baz"  = "foo/bar/baz".
+"foo"/"bar/baz" = "foo/bar/baz".
+"foo/"/"bar/baz" = "foo/bar/baz".
 checking whether `unwritable' is readable...ok
 unwritable file found to be unwritable
 make_directory succeeded
@@ -154,11 +154,11 @@
 type of test_dir/d1/bar is symbolic_link
 dir__foldl2 succeeded
 Files in test_dir:
-test_dir/d1, test_dir/d2, test_dir/quark, test_dir/queeg, test_dir/d3
+test_dir/d1, test_dir/d2, test_dir/d3, test_dir/quark, test_dir/queeg
 dir__recursive_foldl2 (no symlinks) succeeded
 Files in test_dir (recursive, not following symlinks):
-test_dir/d1, test_dir/d1/foo, test_dir/d1/baz, test_dir/d1/bar, test_dir/d1/parent, test_dir/d2, test_dir/d2/d2, test_dir/quark, test_dir/queeg, test_dir/d3
+test_dir/d1, test_dir/d1/bar, test_dir/d1/baz, test_dir/d1/foo, test_dir/d1/parent, test_dir/d2, test_dir/d2/d2, test_dir/d3, test_dir/quark, test_dir/queeg
 dir__recursive_foldl2 (symlinks) succeeded
 Files in test_dir (recursive, following symlinks:
-test_dir/d1, test_dir/d1/foo, test_dir/d1/baz, test_dir/d1/bar, test_dir/d1/parent, test_dir/d2, test_dir/d2/d2, test_dir/quark, test_dir/queeg, test_dir/d3, test_dir/d3/foo, test_dir/d3/baz, test_dir/d3/bar, test_dir/d3/parent
+test_dir/d1, test_dir/d1/bar, test_dir/d1/baz, test_dir/d1/foo, test_dir/d1/parent, test_dir/d2, test_dir/d2/d2, test_dir/d3, test_dir/quark, test_dir/queeg
 dir.recursive_foldl2(list_files, "dir_test.m", ...) failed as expected.
Index: dir_test.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/dir_test.m,v
retrieving revision 1.1
diff -u -u -r1.1 dir_test.m
--- dir_test.m	21 Jul 2003 14:08:42 -0000	1.1
+++ dir_test.m	28 Jul 2003 15:45:44 -0000
@@ -142,7 +142,7 @@
 	testp("dir__foldl2",
 		dir__foldl2(list_files, "test_dir", []), TestDirFiles),
 	io__write_string("Files in test_dir:\n"),
-	io__write_list(reverse(TestDirFiles), ", ", io__write_string),
+	io__write_list(sort(TestDirFiles), ", ", io__write_string),
 	io__nl,
 
 	testp("dir__recursive_foldl2 (no symlinks)",
@@ -150,7 +150,7 @@
 		NoFollowFiles),
 	io__write_string(
 		"Files in test_dir (recursive, not following symlinks):\n"),
-	io__write_list(reverse(NoFollowFiles), ", ", io__write_string),
+	io__write_list(sort(NoFollowFiles), ", ", io__write_string),
 	io__nl,
 
 	testp("dir__recursive_foldl2 (symlinks)",
@@ -158,7 +158,7 @@
 		FollowFiles),
 	io__write_string(
 		"Files in test_dir (recursive, following symlinks:\n"),
-	io__write_list(reverse(FollowFiles), ", ", io__write_string),
+	io__write_list(sort(FollowFiles), ", ", io__write_string),
 	io__nl,
 	
 	dir__recursive_foldl2(list_files, "dir_test.m", yes, [], Res),
@@ -244,7 +244,7 @@
 		io__write_string(DirName),
 		io__write_string(""", """),
 		io__write_string(FileName),
-		io__write_string(""").\n"""),
+		io__write_string(""").\n"),
 		test_make_path_name(DirName, FileName)
 	;
 		io__write_string("_, _) failed.\n")
@@ -303,11 +303,11 @@
 		io__state::di, io__state::uo) is det.
 
 test_make_path_name(DirName, FileName) -->
-	io__write_string(""""),
+	io__write_string("\""),
 	io__write_string(DirName),
-	io__write_string("""/"""),
+	io__write_string("\"/\""),
 	io__write_string(FileName),
-	io__write_string(""" "),
+	io__write_string("\""),
 	{ Res = promise_only_solution(try_det(
 		(pred(R::out) is det :- R = DirName/FileName))) },
 	(
@@ -320,7 +320,7 @@
 		{ error("dir./ failed") }
 	;
 		{ Res = exception(Excp) },
-		io__write_string("threw exception: "),
+		io__write_string(" threw exception: "),
 		io__write(univ_value(Excp)),
 		io__nl
 	).
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list