@@ -60,13 +60,15 @@ fn test_table() {
60
60
for subcommand in [ "stats" , "winrates" , "statistics" ] {
61
61
for table_arg in [ "--human-readable" , "--pretty" ] {
62
62
let out_file = [ "test-scratch/pretty-" , subcommand, table_arg, ".txt" ] . join ( "" ) ;
63
- Command :: new ( & path)
63
+ let output = Command :: new ( & path)
64
64
. arg ( subcommand)
65
65
. arg ( "--pretty" )
66
66
. arg ( & out_file)
67
67
. arg ( & * TEST_ROOT_DIR )
68
68
. output ( )
69
69
. expect ( "Failed to execute command" ) ;
70
+ assert ! ( output. status. success( ) , "command failed" ) ;
71
+
70
72
assert_eq ! (
71
73
std:: fs:: read_to_string( out_file) . expect( "Couldn't read output file" ) ,
72
74
* DESIRED_TABLE_OUTPUT
@@ -83,13 +85,14 @@ fn test_csv() {
83
85
path. push ( "target/debug/psbattletools" ) ;
84
86
for subcommand in [ "stats" , "winrates" , "statistics" ] {
85
87
let out_file = [ "test-scratch/csv-" , subcommand, ".csv" ] . join ( "" ) ;
86
- Command :: new ( & path)
88
+ let output = Command :: new ( & path)
87
89
. arg ( subcommand)
88
90
. arg ( "--csv" )
89
91
. arg ( & out_file)
90
92
. arg ( & * TEST_ROOT_DIR )
91
93
. output ( )
92
94
. expect ( "Failed to execute command" ) ;
95
+ assert ! ( output. status. success( ) , "command failed" ) ;
93
96
94
97
assert_eq ! (
95
98
std:: fs:: read_to_string( out_file) . expect( "Couldn't read output file" ) ,
@@ -110,6 +113,7 @@ fn test_default_output() {
110
113
. arg ( & * TEST_ROOT_DIR )
111
114
. output ( )
112
115
. expect ( "Failed to execute command" ) ;
116
+ assert ! ( output. status. success( ) , "command failed" ) ;
113
117
114
118
let output_str = std:: str:: from_utf8 ( & output. stdout ) . unwrap ( ) ;
115
119
assert_eq ! (
@@ -134,6 +138,7 @@ fn test_min_elo() {
134
138
. arg ( & * TEST_ROOT_DIR )
135
139
. output ( )
136
140
. expect ( "Failed to execute command" ) ;
141
+ assert ! ( normal_output. status. success( ) , "command failed" ) ;
137
142
138
143
let normal_output_str = std:: str:: from_utf8 ( & normal_output. stdout ) . unwrap ( ) ;
139
144
assert_eq ! (
@@ -148,6 +153,7 @@ fn test_min_elo() {
148
153
. arg ( & * TEST_ROOT_DIR )
149
154
. output ( )
150
155
. expect ( "Failed to execute command" ) ;
156
+ assert ! ( no_output. status. success( ) , "command failed" ) ;
151
157
152
158
let no_output_str = std:: str:: from_utf8 ( & no_output. stdout ) . unwrap ( ) ;
153
159
assert ! ( !no_output_str. contains( '%' ) ) ;
@@ -170,6 +176,7 @@ fn test_exclusions() {
170
176
. arg ( & * TEST_ROOT_DIR )
171
177
. output ( )
172
178
. expect ( "Failed to execute command" ) ;
179
+ assert ! ( normal_output. status. success( ) , "command failed" ) ;
173
180
174
181
let normal_output_str = std:: str:: from_utf8 ( & normal_output. stdout ) . unwrap ( ) ;
175
182
assert_eq ! (
@@ -185,6 +192,7 @@ fn test_exclusions() {
185
192
. arg ( & * TEST_ROOT_DIR )
186
193
. output ( )
187
194
. expect ( "Failed to execute command" ) ;
195
+ assert ! ( reduced_output. status. success( ) , "command failed" ) ;
188
196
189
197
let reduced_output_str = std:: str:: from_utf8 ( & reduced_output. stdout ) . unwrap ( ) ;
190
198
assert ! ( !reduced_output_str. contains( "1000" ) ) ; // less than 1000 battles
0 commit comments