File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ let msg = option_env ! ( "_RUST_SCRIPT_TEST_MESSAGE" ) . unwrap_or ( "undefined" ) ;
2
+
3
+ println ! ( "--output--" ) ;
4
+ println ! ( "msg = {}" , msg) ;
Original file line number Diff line number Diff line change @@ -186,6 +186,34 @@ fn test_whitespace_before_main() {
186
186
. unwrap ( )
187
187
}
188
188
189
+ #[ test]
190
+ fn test_force_rebuild ( ) {
191
+ for option in [ "-f" , "--force" ] {
192
+ std:: env:: remove_var ( "_RUST_SCRIPT_TEST_MESSAGE" ) ;
193
+
194
+ let script_path = "tests/data/script-using-env.rs" ;
195
+ let out = rust_script ! ( option, script_path) . unwrap ( ) ;
196
+ scan ! ( out. stdout_output( ) ;
197
+ ( "msg = undefined" ) => ( )
198
+ )
199
+ . unwrap ( ) ;
200
+
201
+ std:: env:: set_var ( "_RUST_SCRIPT_TEST_MESSAGE" , "hello" ) ;
202
+
203
+ let out = rust_script ! ( script_path) . unwrap ( ) ;
204
+ scan ! ( out. stdout_output( ) ;
205
+ ( "msg = undefined" ) => ( )
206
+ )
207
+ . unwrap ( ) ;
208
+
209
+ let out = rust_script ! ( option, script_path) . unwrap ( ) ;
210
+ scan ! ( out. stdout_output( ) ;
211
+ ( "msg = hello" ) => ( )
212
+ )
213
+ . unwrap ( ) ;
214
+ }
215
+ }
216
+
189
217
#[ test]
190
218
#[ ignore]
191
219
fn test_stable_toolchain ( ) {
You can’t perform that action at this time.
0 commit comments