7
7
//! The main challenges is to be able to continue writing to the line above the progress bar.
8
8
//! The output to the terminal should look identical to piped output but contains a progress bar.
9
9
10
- use failure :: Fallible ;
10
+ use anyhow :: Result ;
11
11
12
12
use std:: path:: Path ;
13
13
use std:: time:: Duration ;
@@ -35,7 +35,7 @@ impl Progress {
35
35
}
36
36
37
37
/// Print summary information after the compilation of the test binaries.
38
- pub fn summary_compile ( & mut self , num_mutations : usize , num_testsuites : usize ) -> Fallible < ( ) > {
38
+ pub fn summary_compile ( & mut self , num_mutations : usize , num_testsuites : usize ) -> Result < ( ) > {
39
39
self . bar . println ( "" ) ?;
40
40
self . bar
41
41
. println ( & format ! ( "Total mutations: {}" , num_mutations) ) ?;
@@ -46,29 +46,29 @@ impl Progress {
46
46
}
47
47
48
48
/// Start the section that runs the test suites unmutated.
49
- pub fn section_testsuite_unmutated ( & mut self , num_tests : usize ) -> Fallible < ( ) > {
49
+ pub fn section_testsuite_unmutated ( & mut self , num_tests : usize ) -> Result < ( ) > {
50
50
self . bar . println ( "" ) ?;
51
51
self . bar . println ( & format ! ( "Run {} tests" , num_tests) ) ?;
52
52
Ok ( ( ) )
53
53
}
54
54
55
55
/// start the section of test-runs for each mutation
56
- pub fn section_mutants ( & mut self ) -> Fallible < ( ) > {
56
+ pub fn section_mutants ( & mut self ) -> Result < ( ) > {
57
57
self . bar . println ( "" ) ?;
58
58
self . bar
59
59
. println ( & format ! ( "Test {} Mutants" , self . num_mutations) ) ?;
60
60
Ok ( ( ) )
61
61
}
62
62
63
63
/// start the section of the
64
- pub fn section_summary ( & mut self ) -> Fallible < ( ) > {
64
+ pub fn section_summary ( & mut self ) -> Result < ( ) > {
65
65
self . bar . println ( "" ) ?;
66
66
self . bar . clear_bar ( ) ?;
67
67
Ok ( ( ) )
68
68
}
69
69
70
70
/// indicate the start of a run of a single testsuite without mutations
71
- pub fn start_testsuite_unmutated ( & mut self , bin : & Path , id : usize ) -> Fallible < ( ) > {
71
+ pub fn start_testsuite_unmutated ( & mut self , bin : & Path , id : usize ) -> Result < ( ) > {
72
72
let log_string = format ! ( "{} ... " , bin. display( ) ) ;
73
73
self . bar . print ( log_string) ?;
74
74
@@ -86,7 +86,7 @@ impl Progress {
86
86
}
87
87
88
88
/// indicate the end of a run of a single testsuite and display the result.
89
- pub fn finish_testsuite_unmutated ( & mut self , ok : bool , num_covered : usize ) -> Fallible < ( ) > {
89
+ pub fn finish_testsuite_unmutated ( & mut self , ok : bool , num_covered : usize ) -> Result < ( ) > {
90
90
if ok && num_covered > 0 {
91
91
self . bar . println ( & format ! (
92
92
"ok ({}/{} covered)" ,
@@ -100,7 +100,7 @@ impl Progress {
100
100
}
101
101
102
102
/// print a summary after the testsuites have been run, especially coverage information.
103
- pub fn summary_testsuite_unmutated ( & mut self , num_covered : usize ) -> Fallible < ( ) > {
103
+ pub fn summary_testsuite_unmutated ( & mut self , num_covered : usize ) -> Result < ( ) > {
104
104
self . num_covered = num_covered;
105
105
self . bar . set_total ( num_covered) ;
106
106
@@ -115,7 +115,7 @@ impl Progress {
115
115
///
116
116
/// The information about the mutation is logged to the console.
117
117
/// A call to `finish_mutation` should follow a call to this function
118
- pub fn start_mutation_covered ( & mut self , m : & BakedMutation ) -> Fallible < ( ) > {
118
+ pub fn start_mutation_covered ( & mut self , m : & BakedMutation ) -> Result < ( ) > {
119
119
let mut mutant_log_string = mutation_log_string ( m) ;
120
120
mutant_log_string += " ... " ;
121
121
@@ -141,7 +141,7 @@ impl Progress {
141
141
Ok ( ( ) )
142
142
}
143
143
144
- pub fn skip_mutation_uncovered ( & mut self , m : & BakedMutation ) -> Fallible < ( ) > {
144
+ pub fn skip_mutation_uncovered ( & mut self , m : & BakedMutation ) -> Result < ( ) > {
145
145
self . bar . println ( & format ! (
146
146
"{} ... {}" ,
147
147
mutation_log_string( m) ,
@@ -152,15 +152,15 @@ impl Progress {
152
152
/// indicate that a mutation started with `start_mutation` has been finished.
153
153
///
154
154
/// The status is printed and progress bar is updated
155
- pub fn finish_mutation ( & mut self , status : MutantStatus ) -> Fallible < ( ) > {
155
+ pub fn finish_mutation ( & mut self , status : MutantStatus ) -> Result < ( ) > {
156
156
self . bar . println ( & format ! ( "{}" , status) ) ?;
157
157
Ok ( ( ) )
158
158
}
159
159
160
160
/// indicate that mutation-testing is finished
161
161
///
162
162
/// clears the progress-bar
163
- pub fn finish ( mut self , mutagen_time : Duration ) -> Fallible < ( ) > {
163
+ pub fn finish ( mut self , mutagen_time : Duration ) -> Result < ( ) > {
164
164
let rounded_time = Duration :: from_secs ( mutagen_time. as_secs ( ) ) ;
165
165
self . bar . println ( & format ! (
166
166
"Total time: {}" ,
0 commit comments