File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,12 @@ use crate::config::TomlConfig;
33use super :: { Config , Flags } ;
44use clap:: CommandFactory ;
55use serde:: Deserialize ;
6- use std:: { env, path:: Path } ;
6+ use std:: {
7+ env,
8+ fs:: { remove_file, File } ,
9+ io:: Write ,
10+ path:: Path ,
11+ } ;
712
813fn parse ( config : & str ) -> Config {
914 Config :: parse_inner ( & [ "check" . to_owned ( ) , "--config=/does/not/exist" . to_owned ( ) ] , |& _| {
@@ -196,3 +201,19 @@ fn rust_optimize() {
196201fn invalid_rust_optimize ( ) {
197202 parse ( "rust.optimize = \" a\" " ) ;
198203}
204+
205+ #[ test]
206+ fn verify_file_integrity ( ) {
207+ let config = parse ( "" ) ;
208+
209+ let tempfile = config. tempdir ( ) . join ( ".tmp-test-file" ) ;
210+ File :: create ( & tempfile) . unwrap ( ) . write_all ( b"dummy value" ) . unwrap ( ) ;
211+ assert ! ( tempfile. exists( ) ) ;
212+
213+ assert ! (
214+ config
215+ . verify( & tempfile, "7e255dd9542648a8779268a0f268b891a198e9828e860ed23f826440e786eae5" )
216+ ) ;
217+
218+ remove_file ( tempfile) . unwrap ( ) ;
219+ }
You can’t perform that action at this time.
0 commit comments