Skip to content

Commit

Permalink
Add colouring 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
styczynski committed Oct 21, 2017
1 parent 21a9905 commit df553b1
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 16 deletions.
57 changes: 49 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,61 @@ About minimalistic modes:
In `<prog>`, `--tgerr <dir>`, `--tgout <dir>` and config files you can use special dynamic variables.
These are the following:

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

Example usage:
```
utest "echo %input_file" <folder>
```


Moreover you can use formatting variables (that are set via formatting switches).
Please use them instead of hard-coded values, because it's easy and improves
customizability of your output.

| formatting variable name | description |
|--------------------------|------------------------------------------------|
| **%bdebug** | Begins <b>DEBUG</b> text section |
| **%edebug** | Ends <b>DEBUG</b> text section |
| **%berr** | Begins <b>ERROR</b> text section |
| **%eerr** | Ends <b>ERROR</b> text section |
| **%binfo** | Begins <b>INFORMATION</b> text section |
| **%einfo** | Ends <b>INFORMATION</b> text section |
| **%bwarn** | Begins <b>WARNNING</b> text section |
| **%ewarn** | Ends <b>WARNNING</b> text section |
| **%bbold** | Begins <b>NOTICE</b> text section |
| **%ebold** | Ends <b>NOTICE</b> text section |
| **%bok** | Begins <b>OK STATUS</b> text section |
| **%eok** | Ends <b>OK STATUS</b> text section |

Example usage:
```yaml

input: ./test
executions:
- prog
hooks:
test_case_start:
- @echo %{bwarn}Hello%{ewarn} %input_file %{bok} %ok_index %{eok}
prog:
command: echo Something

```
## Piping
Utest provides easy way to preprocess your input file or postprocess program outputs.
Expand Down
16 changes: 16 additions & 0 deletions utest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,20 @@ E_BOLD=
B_OK=
E_OK=


bdebug="\${B_DEBUG}"
edebug="\${E_DEBUG}"
berr="\${B_ERR}"
eerr="\${E_ERR}"
binfo="\${B_INFO}"
einfo="\${E_INFO}"
bwarn="\${B_WARN}"
ewarn="\${E_WARN}"
bbold="\${B_BOLD}"
ebold="\${E_BOLD}"
bok="\${B_OK}"
eok="\${E_OK}"

TEXT_OK="OK"

# TODO REMOVE
Expand Down Expand Up @@ -1207,6 +1221,8 @@ function run_hook {
silent_mode="true"
fi

#echo -en "HOOK COMMAND IS ${hook_command}"

hook_command_result=$(eval "${hook_command}")
if [[ "${hook_command_result}" != "" ]]; then
if [[ "$silent_mode" = "false" ]]; then
Expand Down
14 changes: 6 additions & 8 deletions utest.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
input: test/*.in
silent: true
good_output: test/%input_file_name.out
need_error_files: false
executions:
- prog1
- prog2
prog1:
command: ./test/totest.sh
args: %input_file_name
pipes_out:
- echo 15 > %output
prog2:
- prog
hooks:
test_case_start:
- @echo %{bwarn}Hello%{ewarn} %input_file %{bok} %ok_index %{eok}
prog:
command: echo 159

0 comments on commit df553b1

Please sign in to comment.