@@ -1328,16 +1328,15 @@ mod tests {
1328
1328
use super :: * ;
1329
1329
1330
1330
#[ track_caller]
1331
- fn assert_diff ( expected_path : impl AsRef < Path > , actual : impl AsRef < str > ) {
1331
+ fn assert_diff ( expected_path : impl AsRef < Path > , actual : impl AsRef < [ u8 ] > ) {
1332
1332
let actual = actual. as_ref ( ) ;
1333
1333
let manifest_dir = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
1334
- let manifest_dir =
1335
- manifest_dir. strip_prefix ( env:: current_dir ( ) . unwrap ( ) ) . unwrap_or ( manifest_dir) ;
1336
1334
let expected_path = & manifest_dir. join ( expected_path) ;
1337
1335
if !expected_path. is_file ( ) {
1336
+ fs:: create_dir_all ( expected_path. parent ( ) . unwrap ( ) ) . unwrap ( ) ;
1338
1337
fs:: write ( expected_path, "" ) . unwrap ( ) ;
1339
1338
}
1340
- let expected = fs:: read_to_string ( expected_path) . unwrap ( ) ;
1339
+ let expected = fs:: read ( expected_path) . unwrap ( ) ;
1341
1340
if expected != actual {
1342
1341
if env:: var_os ( "CI" ) . is_some ( ) {
1343
1342
let mut child = Command :: new ( "git" )
@@ -1347,7 +1346,7 @@ mod tests {
1347
1346
. stdin ( Stdio :: piped ( ) )
1348
1347
. spawn ( )
1349
1348
. unwrap ( ) ;
1350
- child. stdin . as_mut ( ) . unwrap ( ) . write_all ( actual. as_bytes ( ) ) . unwrap ( ) ;
1349
+ child. stdin . as_mut ( ) . unwrap ( ) . write_all ( actual) . unwrap ( ) ;
1351
1350
assert ! ( !child. wait( ) . unwrap( ) . success( ) ) ;
1352
1351
// patch -p1 <<'EOF' ... EOF
1353
1352
panic ! ( "assertion failed; please run test locally and commit resulting changes, or apply above diff as patch" ) ;
@@ -1357,11 +1356,12 @@ mod tests {
1357
1356
}
1358
1357
}
1359
1358
1359
+ // TODO: get help message from actual --help output.
1360
1360
#[ test]
1361
- fn update_readme ( ) -> Result < ( ) > {
1361
+ fn update_readme ( ) {
1362
1362
let new = CARGO_LLVM_COV_USAGE ;
1363
1363
let path = & Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "README.md" ) ;
1364
- let base = fs:: read_to_string ( path) ? ;
1364
+ let base = fs:: read_to_string ( path) . unwrap ( ) ;
1365
1365
let mut out = String :: with_capacity ( base. capacity ( ) ) ;
1366
1366
let mut lines = base. lines ( ) ;
1367
1367
let mut start = false ;
@@ -1392,6 +1392,5 @@ mod tests {
1392
1392
} else {
1393
1393
panic ! ( "missing `<!-- readme-long-help:start -->` comment in README.md" ) ;
1394
1394
}
1395
- Ok ( ( ) )
1396
1395
}
1397
1396
}
0 commit comments