File tree 1 file changed +22
-1
lines changed
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;
3
3
use super :: { Config , Flags } ;
4
4
use clap:: CommandFactory ;
5
5
use 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
+ } ;
7
12
8
13
fn parse ( config : & str ) -> Config {
9
14
Config :: parse_inner ( & [ "check" . to_owned ( ) , "--config=/does/not/exist" . to_owned ( ) ] , |& _| {
@@ -196,3 +201,19 @@ fn rust_optimize() {
196
201
fn invalid_rust_optimize ( ) {
197
202
parse ( "rust.optimize = \" a\" " ) ;
198
203
}
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