@@ -13,76 +13,4 @@ pub fn path_name(path: &Path) -> OsStringDisplay {
1313}
1414
1515#[ cfg( test) ]
16- use pretty_assertions:: assert_eq;
17- #[ cfg( test) ]
18- use std:: path:: PathBuf ;
19-
20- #[ test]
21- fn empty ( ) {
22- let actual = path_name ( & PathBuf :: new ( ) ) ;
23- let expected = OsStringDisplay :: os_string_from ( "." ) ;
24- assert_eq ! ( actual, expected) ;
25- }
26-
27- #[ test]
28- fn current_dir ( ) {
29- let actual = path_name ( & PathBuf :: from ( "." ) ) ;
30- let expected = OsStringDisplay :: os_string_from ( "." ) ;
31- assert_eq ! ( actual, expected) ;
32- }
33-
34- #[ cfg( unix) ]
35- #[ test]
36- fn root_dir ( ) {
37- let actual = path_name ( & PathBuf :: from ( "/" ) ) ;
38- let expected = OsStringDisplay :: os_string_from ( "/" ) ;
39- assert_eq ! ( actual, expected) ;
40- }
41-
42- #[ cfg( windows) ]
43- #[ test]
44- fn root_dir ( ) {
45- let actual = path_name ( & PathBuf :: from ( "C:\\ " ) ) ;
46- let expected = OsStringDisplay :: os_string_from ( "c:" ) ;
47- assert_eq ! ( actual, expected) ;
48- }
49-
50- #[ cfg( unix) ]
51- #[ test]
52- fn normal_relative ( ) {
53- let actual = path_name ( & PathBuf :: from ( "abc/def/ghi" ) ) ;
54- let expected = OsStringDisplay :: os_string_from ( "ghi" ) ;
55- assert_eq ! ( actual, expected) ;
56- }
57-
58- #[ cfg( unix) ]
59- #[ test]
60- fn normal_absolute ( ) {
61- let actual = path_name ( & PathBuf :: from ( "/abc/def/ghi" ) ) ;
62- let expected = OsStringDisplay :: os_string_from ( "ghi" ) ;
63- assert_eq ! ( actual, expected) ;
64- }
65-
66- #[ cfg( unix) ]
67- #[ test]
68- fn normal_trailing_separator ( ) {
69- let actual = path_name ( & PathBuf :: from ( "abc/def/ghi/" ) ) ;
70- let expected = OsStringDisplay :: os_string_from ( "ghi" ) ;
71- assert_eq ! ( actual, expected) ;
72- }
73-
74- #[ cfg( unix) ]
75- #[ test]
76- fn parent_dir ( ) {
77- let actual = path_name ( & PathBuf :: from ( ".." ) ) ;
78- let expected = OsStringDisplay :: os_string_from ( ".." ) ;
79- assert_eq ! ( actual, expected) ;
80- }
81-
82- #[ cfg( unix) ]
83- #[ test]
84- fn grandparent_dir ( ) {
85- let actual = path_name ( & PathBuf :: from ( "../.." ) ) ;
86- let expected = OsStringDisplay :: os_string_from ( "../.." ) ;
87- assert_eq ! ( actual, expected) ;
88- }
16+ mod test_path_name;
0 commit comments