@@ -104,21 +104,33 @@ pub fn default_config(input_crate: &Path) -> Config {
104
104
}
105
105
}
106
106
107
- type ProgramOutput = fn ~( ( & str) , ( & [ ~str] ) ) ->
108
- { status: int, out: ~str , err: ~str } ;
107
+ struct ProcOut {
108
+ status : int,
109
+ out : ~str,
110
+ err : ~str
111
+ }
112
+
113
+ type ProgramOutput = fn ~( ( & str) , ( & [ ~str] ) ) -> ProcOut ;
109
114
110
- pub fn mock_program_output( _prog: & str, _args: & [ ~str] ) -> {
111
- status: int, out: ~str , err: ~str
112
- } {
113
- {
115
+ pub fn mock_program_output( _prog: & str, _args: & [ ~str] ) -> ProcOut {
116
+ ProcOut {
114
117
status : 0 ,
115
118
out: ~"",
116
119
err: ~""
117
120
}
118
121
}
119
122
123
+ pub fn program_output( prog: & str, args: & [ ~str] ) -> ProcOut {
124
+ let { status, out, err} = run:: program_output( prog, args) ;
125
+ ProcOut {
126
+ status : status,
127
+ out : out,
128
+ err : err
129
+ }
130
+ }
131
+
120
132
pub fn parse_config( args: & [ ~str] ) -> Result < Config , ~str > {
121
- parse_config_( args, run :: program_output)
133
+ parse_config_( args, program_output)
122
134
}
123
135
124
136
pub fn parse_config_(
@@ -260,10 +272,8 @@ fn should_find_pandoc() {
260
272
output_format : PandocHtml ,
261
273
.. default_config( & Path ( "test" ) )
262
274
} ;
263
- let mock_program_output = fn ~( _prog: & str, _args: & [ ~str] ) -> {
264
- status: int, out: ~str , err: ~str
265
- } {
266
- {
275
+ let mock_program_output = fn ~( _prog: & str, _args: & [ ~str] ) -> ProcOut {
276
+ ProcOut {
267
277
status : 0 , out : ~"pandoc 1.8 . 2.1 ", err: ~""
268
278
}
269
279
} ;
@@ -277,10 +287,8 @@ fn should_error_with_no_pandoc() {
277
287
output_format : PandocHtml ,
278
288
.. default_config( & Path ( "test" ) )
279
289
} ;
280
- let mock_program_output = fn ~( _prog: & str, _args: & [ ~str] ) -> {
281
- status: int, out: ~str , err: ~str
282
- } {
283
- {
290
+ let mock_program_output = fn ~( _prog: & str, _args: & [ ~str] ) -> ProcOut {
291
+ ProcOut {
284
292
status : 1 , out: ~"", err: ~""
285
293
}
286
294
} ;
0 commit comments