@@ -175,6 +175,30 @@ color() {
175
175
if [ -t 1 ] ; then echo -en " $NOCOLOR " ; fi
176
176
}
177
177
178
+ pretty_format () {
179
+ local color=" $1 "
180
+ local pretty_symbol=" $2 "
181
+ local alt_symbol=" $3 "
182
+ [ -t 1 ] && local term=true || local term=false
183
+ (
184
+ cat
185
+ if $term
186
+ then
187
+ echo -en " $pretty_symbol "
188
+ else
189
+ [[ ! -z " $alt_symbol " ]] && echo -en " $alt_symbol "
190
+ fi
191
+ ) | color " $color "
192
+ }
193
+
194
+ pretty_success () {
195
+ pretty_format " $GREEN " " \u2713" " $1 "
196
+ }
197
+
198
+ pretty_failure () {
199
+ pretty_format " $RED " " \u2717" " $1 "
200
+ }
201
+
178
202
text_format () {
179
203
notify_suite_starting () {
180
204
test_file=" $1 "
@@ -185,11 +209,13 @@ text_format() {
185
209
echo -n " Running $test ... " | color " $BLUE "
186
210
}
187
211
notify_test_succeeded () {
188
- color " $GREEN " " SUCCESS"
212
+ echo -n " SUCCESS" | pretty_success
213
+ echo
189
214
}
190
215
notify_test_failed () {
191
216
local message=" $2 "
192
- color " $RED " " FAILURE"
217
+ echo -n " FAILURE" | pretty_failure
218
+ echo
193
219
[[ -z $message ]] || printf -- " $message \n"
194
220
}
195
221
notify_stdout () {
@@ -213,16 +239,14 @@ tap_format() {
213
239
}
214
240
notify_test_succeeded () {
215
241
local test=" $1 "
216
- echo -n " ok" | color " $GREEN "
217
- echo -n ' - '
242
+ echo -n " ok" | pretty_success -
218
243
echo " $test " | color " $BLUE "
219
244
}
220
245
notify_test_failed () {
221
246
local test=" $1 "
222
247
local message=" $2 "
223
- echo -n " not ok" | color " $RED "
224
- echo -n " - "
225
- echo " $test "
248
+ echo -n " not ok" | pretty_failure -
249
+ echo " $test " | color " $BLUE "
226
250
[[ -z $message ]] || printf -- " $message \n" | sed -u -e ' s/^/# /'
227
251
}
228
252
notify_stdout () {
0 commit comments