Skip to content

Commit

Permalink
Fix CRLF 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
styczynski committed Oct 30, 2017
1 parent 66d4a72 commit 70ebfca
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bash-universal-tester",
"version": "1.9.0",
"version": "1.9.1",
"description": "Universal testing script for bash",
"keywords": "bash, testing, tester, utest, bash-test, testing, script",
"homepage": "https://github.com/styczynski/bash-universal-tester",
Expand Down
47 changes: 36 additions & 11 deletions utest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ flag_hook_test_case_fail_err=()
flag_hook_test_case_fail_out=()
flag_hook_test_case_fail=()
flag_hook_test_case_success=()
flag_hook_command_clear=()

# Should be changed
flag_no_pipes="false"
Expand Down Expand Up @@ -299,23 +300,27 @@ function stdoutplain {
}

function clean_temp_content {
# FIX CLEAN
if [[ ${flag_out_temp} = 'true' ]]; then
rm -f -r $flag_out_path/*
fi
if [[ ${flag_err_temp} = 'true' ]]; then
rm -f -r $flag_err_path/*
fi
echo -en ""
}



function clean_temp {
# FIX CLEAN
if [[ ${flag_out_temp} = 'true' ]]; then
rm -f -r $flag_out_path
fi
if [[ ${flag_err_temp} = 'true' ]]; then
rm -f -r $flag_err_path
fi
echo -en ""
}

function close {
Expand Down Expand Up @@ -418,20 +423,32 @@ function update_loc {
param_dir="$filename"
}

function run_command_clear {
sready
stdout "${B_INFO}Clearing temp build directiories...${E_INFO}\n"
rm -f -r $flag_out_path/*
rm -f -r $flag_err_path/*
sbusy
run_hook "command_clear"
}


function prepare_input {

if [[ "${param_original_command}" = "clear" ]]; then
run_command_clear
close 0
fi

regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
if [[ ! "${param_prog}" = "" ]]; then
if [[ "${param_dir}" = "" ]]; then
if [[ $param_prog =~ $regex ]]
then
param_dir="$param_prog"
param_prog=""
fi
fi
if [[ "${param_original_command}" = "" ]]; then
if [[ $param_original_command =~ $regex ]]
then
param_dir="$param_original_command"
param_prog=""
fi
fi

if [[ $param_dir =~ $regex ]]
then
# Link is valid URL so try to download file
Expand Down Expand Up @@ -643,8 +660,9 @@ function set_format {
function clean_out_err_paths {
mkdir -p $flag_out_path
mkdir -p $flag_err_path
rm -f -r $flag_out_path/*
rm -f -r $flag_err_path/*
# FIX CLEAN
#rm -f -r $flag_out_path/*
#rm -f -r $flag_err_path/*
}


Expand Down Expand Up @@ -801,6 +819,11 @@ function run_testing {
flag_good_out_path=$(evalspecplain "$flag_good_out_path")
flag_good_err_path=$(evalspecplain "$flag_good_err_path")

out_path=$flag_out_path/${input_file}
err_path=$flag_out_path/${input_file}
out_path=$(evalspecplain "$out_path")
err_path=$(evalspecplain "$err_path")

if [[ "$flag_good_out_path" != "$flag_good_out_path_unparsed" ]]; then
good_out_path="$flag_good_out_path"
else
Expand Down Expand Up @@ -1114,6 +1137,7 @@ function load_global_configuration_file {
load_prop_variable_arr "global_config_" "hooks__test_case_fail_out_" "flag_hook_test_case_fail_out"
load_prop_variable_arr "global_config_" "hooks__test_case_fail_" "flag_hook_test_case_fail"
load_prop_variable_arr "global_config_" "hooks__test_case_success_" "flag_hook_test_case_success"
load_prop_variable_arr "global_config_" "hooks__command_clear_" "flag_hook_command_clear"



Expand Down Expand Up @@ -1794,6 +1818,7 @@ do
if [[ "$param_counter" == 0 ]]; then
param_counter=1
param_prog="$1"
param_original_command="$1"
else
if [[ "$param_counter" == 1 ]]; then
param_counter=2
Expand Down
4 changes: 3 additions & 1 deletion utest.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
input: test/*.in
silent: true
silent: false
good_output: test/%input_file_name.out
need_error_files: false
executions:
- prog
hooks:
command_clear:
- @echo Cleared
test_case_start:
- @echo %{bwarn}Hello%{ewarn} %input_file %{bok} %ok_index %{eok}
prog:
Expand Down

0 comments on commit 70ebfca

Please sign in to comment.