@@ -8,26 +8,73 @@ use ouch::{cli::Command, commands::run, oof};
88use rand:: { rngs:: SmallRng , RngCore , SeedableRng } ;
99
1010#[ test]
11- /// Tests each format that supports multiple files with random input.
12- /// TODO: test the remaining formats.
13- fn test_each_format ( ) {
11+ fn test_compressing_and_decompressing_archive_tar ( ) {
1412 test_compressing_and_decompressing_archive ( "tar" ) ;
13+ }
14+
15+ #[ test]
16+ fn test_compressing_and_decompressing_archive_tar_gz ( ) {
1517 test_compressing_and_decompressing_archive ( "tar.gz" ) ;
18+ }
19+
20+ #[ test]
21+ fn test_compressing_and_decompressing_archive_tar_bz ( ) {
1622 test_compressing_and_decompressing_archive ( "tar.bz" ) ;
23+ }
24+
25+ #[ test]
26+ fn test_compressing_and_decompressing_archive_tar_bz2 ( ) {
1727 test_compressing_and_decompressing_archive ( "tar.bz2" ) ;
28+ }
29+
30+ #[ test]
31+ fn test_compressing_and_decompressing_archive_tar_xz ( ) {
1832 test_compressing_and_decompressing_archive ( "tar.xz" ) ;
33+ }
34+
35+ #[ test]
36+ fn test_compressing_and_decompressing_archive_tar_lz ( ) {
1937 test_compressing_and_decompressing_archive ( "tar.lz" ) ;
38+ }
39+
40+ #[ test]
41+ fn test_compressing_and_decompressing_archive_tar_lzma ( ) {
2042 test_compressing_and_decompressing_archive ( "tar.lzma" ) ;
43+ }
44+
45+ #[ test]
46+ fn test_compressing_and_decompressing_archive_zip ( ) {
2147 test_compressing_and_decompressing_archive ( "zip" ) ;
48+ }
49+
50+ #[ test]
51+ fn test_compressing_and_decompressing_archive_zip_gz ( ) {
2252 test_compressing_and_decompressing_archive ( "zip.gz" ) ;
53+ }
54+
55+ #[ test]
56+ fn test_compressing_and_decompressing_archive_zip_bz ( ) {
2357 test_compressing_and_decompressing_archive ( "zip.bz" ) ;
58+ }
59+
60+ #[ test]
61+ fn test_compressing_and_decompressing_archive_zip_bz2 ( ) {
2462 test_compressing_and_decompressing_archive ( "zip.bz2" ) ;
63+ }
64+
65+ #[ test]
66+ fn test_compressing_and_decompressing_archive_zip_xz ( ) {
2567 test_compressing_and_decompressing_archive ( "zip.xz" ) ;
68+ }
69+
70+ #[ test]
71+ fn test_compressing_and_decompressing_archive_zip_lz ( ) {
2672 test_compressing_and_decompressing_archive ( "zip.lz" ) ;
27- test_compressing_and_decompressing_archive ( "zip.lzma" ) ;
73+ }
2874
29- // Why not
30- test_compressing_and_decompressing_archive ( "tar.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.gz.lz.lz.lz.lz.lz.lz.lz.lz.lz.lz.bz.bz.bz.bz.bz.bz.bz" ) ;
75+ #[ test]
76+ fn test_compressing_and_decompressing_archive_zip_lzma ( ) {
77+ test_compressing_and_decompressing_archive ( "zip.lzma" ) ;
3178}
3279
3380type FileContent = Vec < u8 > ;
@@ -37,9 +84,12 @@ fn test_compressing_and_decompressing_archive(format: &str) {
3784 // System temporary directory depends on the platform, for linux it's /tmp
3885 let system_tmp = env:: temp_dir ( ) ;
3986
87+ let testing_dir_prefix = format ! ( "ouch-testing-{}" , format. replace( '.' , "-" ) ) ;
88+ dbg ! ( & testing_dir_prefix) ;
89+
4090 // Create a temporary testing folder that will be deleted on scope drop
4191 let testing_dir = tempfile:: Builder :: new ( )
42- . prefix ( "ouch-testing" )
92+ . prefix ( & testing_dir_prefix )
4393 . tempdir_in ( system_tmp)
4494 . expect ( "Could not create testing_dir" ) ;
4595 let testing_dir_path = testing_dir. path ( ) ;
0 commit comments