diff --git a/README.md b/README.md index 0400610..34f2d55 100644 --- a/README.md +++ b/README.md @@ -177,20 +177,61 @@ About minimalistic modes: In ``, `--tgerr `, `--tgout ` 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" ``` + +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 DEBUG text section | +| **%edebug** | Ends DEBUG text section | +| **%berr** | Begins ERROR text section | +| **%eerr** | Ends ERROR text section | +| **%binfo** | Begins INFORMATION text section | +| **%einfo** | Ends INFORMATION text section | +| **%bwarn** | Begins WARNNING text section | +| **%ewarn** | Ends WARNNING text section | +| **%bbold** | Begins NOTICE text section | +| **%ebold** | Ends NOTICE text section | +| **%bok** | Begins OK STATUS text section | +| **%eok** | Ends OK STATUS 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. diff --git a/utest.sh b/utest.sh index 75a9435..cd27bad 100644 --- a/utest.sh +++ b/utest.sh @@ -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 @@ -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 diff --git a/utest.yaml b/utest.yaml index 6592734..2be4bdc 100644 --- a/utest.yaml +++ b/utest.yaml @@ -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 \ No newline at end of file