File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,48 @@ fn failing_command() {
75
75
} ) ;
76
76
}
77
77
78
+ // Test that renderer utilizes PATH to find mdbook-FOO executables.
79
+ #[ test]
80
+ fn renderer_utilizes_path ( ) {
81
+ let mut test = BookTest :: init ( |_| { } ) ;
82
+ test. rust_program (
83
+ "custom_directory/mdbook-in_path" ,
84
+ r#"
85
+ fn main() {
86
+ // Read from stdin to avoid random pipe failures on Linux.
87
+ use std::io::Read;
88
+ let mut s = String::new();
89
+ std::io::stdin().read_to_string(&mut s).unwrap();
90
+ println!("Hello World!");
91
+ }
92
+ "# ,
93
+ )
94
+ . change_file (
95
+ "book.toml" ,
96
+ "[output.in_path]\n \
97
+ ",
98
+ ) ;
99
+ let custom_directory_path = test
100
+ . dir
101
+ . join ( "custom_directory" )
102
+ . to_str ( )
103
+ . unwrap ( )
104
+ . to_string ( ) ;
105
+ test. run ( "build" , |cmd| {
106
+ cmd. env ( "PATH" , format ! ( "$PATH:{}" , custom_directory_path) ) ;
107
+ cmd. expect_stdout ( str![ [ r#"
108
+ Hello World!
109
+
110
+ "# ] ] )
111
+ . expect_stderr ( str![ [ r#"
112
+ [TIMESTAMP] [INFO] (mdbook::book): Book building has started
113
+ [TIMESTAMP] [INFO] (mdbook::book): Running the in_path backend
114
+ [TIMESTAMP] [INFO] (mdbook::renderer): Invoking the "in_path" renderer
115
+
116
+ "# ] ] ) ;
117
+ } ) ;
118
+ }
119
+
78
120
// Renderer command is missing.
79
121
#[ test]
80
122
fn missing_renderer ( ) {
You can’t perform that action at this time.
0 commit comments