Skip to content

Commit df553b1

Browse files
committed
Add colouring 🎉
1 parent 21a9905 commit df553b1

File tree

3 files changed

+71
-16
lines changed

3 files changed

+71
-16
lines changed

README.md

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,61 @@ About minimalistic modes:
177177
In `<prog>`, `--tgerr <dir>`, `--tgout <dir>` and config files you can use special dynamic variables.
178178
These are the following:
179179

180-
| name | description |
181-
|------------------------|------------------------------------------------------------------|
182-
| **%input_file** | Current input file name along with extension |
183-
| **%input_file_name** | Current input file without .in or .out extension |
184-
| **%input_file_folder** | Directory of current input file |
185-
| **%input_file_path** | Full input path |
186-
| **%input_file_list** | List of all input files (separated by space) that will be loaded |
187-
| **%file_count** | Number of all input files that will be loaded |
180+
| name | description |
181+
|--------------------------|------------------------------------------------------------------|
182+
| **%input_file** | Current input file name along with extension |
183+
| **%input_file_name** | Current input file without .in or .out extension |
184+
| **%input_file_folder** | Directory of current input file |
185+
| **%input_file_path** | Full input path |
186+
| **%input_file_list** | List of all input files (separated by space) that will be loaded |
187+
| **%file_count** | Number of all input files that will be loaded |
188+
| **%file_index** | Number of the current input file starting from 1 |
189+
| **%ok_index** | Current number of test that succeeded |
190+
| **%warn_index** | Current number of test that generated warnnings |
191+
| **%not_exists_index** | Current number of test that had problems with non existing files |
192+
| **%param_prog** | Currently tested command |
193+
| **%input_prog_flag_acc** | Currently tested command's arguments |
188194

189195
Example usage:
190196
```
191197
utest "echo %input_file" <folder>
192198
```
193199

200+
201+
Moreover you can use formatting variables (that are set via formatting switches).
202+
Please use them instead of hard-coded values, because it's easy and improves
203+
customizability of your output.
204+
205+
| formatting variable name | description |
206+
|--------------------------|------------------------------------------------|
207+
| **%bdebug** | Begins <b>DEBUG</b> text section |
208+
| **%edebug** | Ends <b>DEBUG</b> text section |
209+
| **%berr** | Begins <b>ERROR</b> text section |
210+
| **%eerr** | Ends <b>ERROR</b> text section |
211+
| **%binfo** | Begins <b>INFORMATION</b> text section |
212+
| **%einfo** | Ends <b>INFORMATION</b> text section |
213+
| **%bwarn** | Begins <b>WARNNING</b> text section |
214+
| **%ewarn** | Ends <b>WARNNING</b> text section |
215+
| **%bbold** | Begins <b>NOTICE</b> text section |
216+
| **%ebold** | Ends <b>NOTICE</b> text section |
217+
| **%bok** | Begins <b>OK STATUS</b> text section |
218+
| **%eok** | Ends <b>OK STATUS</b> text section |
219+
220+
Example usage:
221+
```yaml
222+
223+
input: ./test
224+
executions:
225+
- prog
226+
hooks:
227+
test_case_start:
228+
- @echo %{bwarn}Hello%{ewarn} %input_file %{bok} %ok_index %{eok}
229+
prog:
230+
command: echo Something
231+
232+
```
233+
234+
194235
## Piping
195236
196237
Utest provides easy way to preprocess your input file or postprocess program outputs.

utest.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,20 @@ E_BOLD=
265265
B_OK=
266266
E_OK=
267267

268+
269+
bdebug="\${B_DEBUG}"
270+
edebug="\${E_DEBUG}"
271+
berr="\${B_ERR}"
272+
eerr="\${E_ERR}"
273+
binfo="\${B_INFO}"
274+
einfo="\${E_INFO}"
275+
bwarn="\${B_WARN}"
276+
ewarn="\${E_WARN}"
277+
bbold="\${B_BOLD}"
278+
ebold="\${E_BOLD}"
279+
bok="\${B_OK}"
280+
eok="\${E_OK}"
281+
268282
TEXT_OK="OK"
269283

270284
# TODO REMOVE
@@ -1207,6 +1221,8 @@ function run_hook {
12071221
silent_mode="true"
12081222
fi
12091223

1224+
#echo -en "HOOK COMMAND IS ${hook_command}"
1225+
12101226
hook_command_result=$(eval "${hook_command}")
12111227
if [[ "${hook_command_result}" != "" ]]; then
12121228
if [[ "$silent_mode" = "false" ]]; then

utest.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
input: test/*.in
2+
silent: true
23
good_output: test/%input_file_name.out
34
need_error_files: false
45
executions:
5-
- prog1
6-
- prog2
7-
prog1:
8-
command: ./test/totest.sh
9-
args: %input_file_name
10-
pipes_out:
11-
- echo 15 > %output
12-
prog2:
6+
- prog
7+
hooks:
8+
test_case_start:
9+
- @echo %{bwarn}Hello%{ewarn} %input_file %{bok} %ok_index %{eok}
10+
prog:
1311
command: echo 159

0 commit comments

Comments
 (0)