File tree Expand file tree Collapse file tree 1 file changed +24
-7
lines changed
Expand file tree Collapse file tree 1 file changed +24
-7
lines changed Original file line number Diff line number Diff line change 11use displaydoc:: Display ;
2- // use std::path::PathBuf;
2+
3+ #[ cfg( feature = "std" ) ]
4+ use std:: path:: PathBuf ;
5+
6+ #[ derive( Display ) ]
7+ /// Just a basic struct {thing}
8+ struct HappyStruct {
9+ thing : & ' static str ,
10+ }
311
412#[ derive( Display ) ]
513enum Happy {
@@ -18,8 +26,10 @@ enum Happy {
1826 /// Variant5 just has {0} many problems
1927 /// but multi line comments aren't one of them
2028 Variant5 ( u32 ) ,
21- // /// The path {0.display()}
22- // Variant6(PathBuf),
29+
30+ /// The path {0}
31+ #[ cfg( feature = "std" ) ]
32+ Variant6 ( PathBuf ) ,
2333}
2434
2535fn assert_display < T : std:: fmt:: Display > ( input : T , expected : & ' static str ) {
@@ -37,8 +47,15 @@ fn does_it_print() {
3747 "Variant4 wants to have a lot of lines\n \n Lets see how this works out for it" ,
3848 ) ;
3949 assert_display ( Happy :: Variant5 ( 2 ) , "Variant5 just has 2 many problems" ) ;
40- // assert_display(
41- // Happy::Variant6(PathBuf::from("/var/log/happy")),
42- // "The path /var/log/happy",
43- // );
50+
51+ assert_display ( HappyStruct { thing : "hi" } , "Just a basic struct hi" ) ;
52+ }
53+
54+ #[ test]
55+ #[ cfg( feature = "std" ) ]
56+ fn does_it_print_path ( ) {
57+ assert_display (
58+ Happy :: Variant6 ( PathBuf :: from ( "/var/log/happy" ) ) ,
59+ "The path /var/log/happy" ,
60+ ) ;
4461}
You can’t perform that action at this time.
0 commit comments