Commit 977b3db 1 parent caedfcb commit 977b3db Copy full SHA for 977b3db
File tree 4 files changed +28
-11
lines changed
4 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -324,17 +324,7 @@ impl CompilerCommand {
324
324
#[ test]
325
325
#[ cfg_attr( miri, ignore) ]
326
326
fn compiler_command_new_no_out_dir ( ) {
327
+ std:: env:: remove_var ( "OUT_DIR" ) ;
327
328
let error = CompilerCommand :: new ( ) . run ( ) . unwrap_err ( ) . description ;
328
329
assert ! ( error. starts_with( "Could not access `OUT_DIR` environment variable" ) ) ;
329
330
}
330
-
331
- #[ test]
332
- #[ cfg_attr( miri, ignore) ]
333
- fn compiler_command_with_output_path_no_out_dir ( ) {
334
- let error = CompilerCommand :: new ( )
335
- . output_path ( "foo" )
336
- . run ( )
337
- . unwrap_err ( )
338
- . description ;
339
- assert ! ( error. starts_with( "Error while trying to execute `capnp compile`" ) ) ;
340
- }
Original file line number Diff line number Diff line change @@ -22,4 +22,15 @@ fn main() {
22
22
] )
23
23
. run ( )
24
24
. expect ( "compiling schema" ) ;
25
+
26
+ let mut output_path =
27
+ std:: path:: PathBuf :: from ( std:: env:: var ( "OUT_DIR" ) . expect ( "OUT_DIR env var is not set" ) ) ;
28
+
29
+ // `capnp compile` will create this directory
30
+ output_path. push ( "inner-output-path" ) ;
31
+ capnpc:: CompilerCommand :: new ( )
32
+ . file ( "test-output-path.capnp" )
33
+ . output_path ( output_path)
34
+ . run ( )
35
+ . expect ( "compiling schema" )
25
36
}
Original file line number Diff line number Diff line change
1
+ # Schema to use to test `CompilerCommand::output_path()`.
2
+
3
+ @0xbc9d501a1b13e0e9 ;
4
+
5
+ struct Foo {}
6
+
7
+ struct Bar {
8
+ foo @0 : Foo;
9
+ }
Original file line number Diff line number Diff line change @@ -71,6 +71,13 @@ pub mod test_in_src_prefix_dir_capnp {
71
71
include ! ( concat!( env!( "OUT_DIR" ) , "/test_in_src_prefix_dir_capnp.rs" ) ) ;
72
72
}
73
73
74
+ pub mod test_output_path_capnp {
75
+ include ! ( concat!(
76
+ env!( "OUT_DIR" ) ,
77
+ "/inner-output-path/test_output_path_capnp.rs"
78
+ ) ) ;
79
+ }
80
+
74
81
#[ cfg( test) ]
75
82
mod test_util;
76
83
You can’t perform that action at this time.
0 commit comments