Skip to content
Commits on Source (9)
*.swp
FUNCREF.md
tests/testout.md
# Changes in shell-docs-generator
## 1.5 (2017-11-02)
* is\_array(), fix handling read-only arrays.
* is\_empty() renamed to is\_empty\_str().
* added a new is\_empty().
* added is\_declared().
* use a table within the return-code section.
* add ascii\_to\_int().
* add int\_to\_ascii().
* automatically count sections within a stanza instead of hard-coded one's.
* now prints the generated text default to STDOUT (like if '-' output parameter
is given).
* add new tag 'deprecated'.
* output TOC-tag (and a note that this is the job of the markdown-renderer to fulfill.
## 1.4.1 (2017-10-31)
* make the created-by line contain the english-language, UTC time.
......
# shell-docs-generator
| Tag | Value |
| - | - |
| Author | Andreas Unterkircher |
| Version | 1.5 |
| License | AGPLv3 |
<!-- if a table-of-contents gets actually rendered, depends on your markdown-viewer -->
[TOC]
## 1. Function `sanitize`
This function tries to sanitize the provided string and removes all characters
from the string that are not matching the provided pattern mask.
### 1a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | text |
### 1b. Output
`string`
### 1b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 2. Function `parse_parameters`
This function parse the given command-line parameters and arguments by using
GNU getopt.
### 2a. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 3. Function `in_array`
searches the array $1 for the value given in $2. $2 may even contain a
regular expression pattern. On success, it returns 0. Otherwise 1 is returned.
### 3a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | array-name |
| *$2* | string | needle |
### 3b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 4. Function `in_array_re`
This function works similar as in_array(), but uses the patterns that have
been stored in the array $1 against the fixed string provided with $2. On
success, it returns 0. Otherwise 1 is returned.
### 4a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | array-name |
| *$2* | string | needle |
### 4b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 5. Function `is_array`
This function tests if the provided array $1 is either an indexed- or an
associative-array. If so, the function returns 0, otherwise 1.
### 5a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | array-name |
### 5b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 6. Function `is_empty`
returns 0, if the provided string or array variable have a value of length
of zero. Otherwise it returns 1.
### 6a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string|array | $string |
### 6b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
| Value | 0 on success, 1 on failure |
## 7. Function `is_empty_str`
This function is actually just a wrapper around the already simple
zero-length-string-test 'test -z'. But this wrapper helps to make the rest of
the code a bit easier to read. If the string is empty, it returns 0. Otherwise
it returns 1.
### 7a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | var-name |
### 7b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 8. Function `is_declared`
returns 0 if the provided variable has been declared (that does not mean,
that the variable actually has a value!), otherwise it returns 1.
### 8a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | $var |
### 8b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
| Value | 0 on success, 1 on failure |
## 9. Function `is_allowed_tag`
This function tests the provided tag-name for any match in the ALLOWED_TAGS
array. On success, it returns 0. Otherwise it will return 1.
### 9a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | tag |
### 9b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 10. Function `is_cmd`
returns 0, if the provided external command exists. Otherwise it returns 1.
### 10a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | $command |
### 10b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
| Value | 0 on success, 1 on failure |
## 11. Function `is_debug`
This function returns 0, if debugging has been enabled. Otherwise it will
return 1.
### 11a. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 12. Function `debug`
This function issues debugging-output, but only if debugging has actually been
enabled. Otherwise, output is suppressed. Note: Debug-output is sent to STDERR!
### 12a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | text |
### 12b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 13. Function `write`
Adds the provided text to MARKDOWN_RESULT array.
### 13a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | text |
### 13b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 14. Function `mdout`
Writes the provided text to the OUTPUT file.
### 14a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | text |
### 14b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 15. Function `read_file`
This function reads the provided file into the indexed-array CODE_SRC. On
success it returns 0, otherwise it will return non-zero.
### 15a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | file |
### 15b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 16. Function `parse_input`
This function is the actual workhorse of the shell-docs-generator. It parses
the lines stored in the CODE_SRC array and extracts all documentation tags. On
success, this function returns 0. Otherwise it returns non-zero.
### 16a. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 17. Function `ascii_to_int`
Converts a single ASCII character to its decimal representation.
### 17a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | $ascii |
### 17b. Output
`int`
### 17b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
### 17c. Example
```
echo $(ascii_to_int A) --> 65
```
## 18. Function `int_to_ascii`
Converts a decimal value to its corresponding ASCII character.
### 18a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | int | $i |
### 18b. Output
`string`
### 18b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
### 18c. Example
```
echo $(int_to_ascii 65) --> A
```
## 19. Function `formated_output`
This function performs the actual output of the generated documentation into
the $OUTPUT file. On success it returns 0, otherwise it returns non-zero.
### 19a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | array | array-name |
### 19b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 20. Function `show_help`
Output help text
### 20a. Output
`string`
### 20a. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 21. Function `fail`
prints the fail-text as well as the function and code-line from which it
was called.
### 21a. Parameters
| ID | Type | Description |
| - | - | - |
| *$1* | string | $fail_text |
### 21b. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
## 22. Function `output_markdown`
This function performs the actual output of the Markdown-formated text. It
retrieves its information from the MARKDOWN_RESULT array, that was previously
filled by parse_input(). The output is stored in the $OUTPUT file.
### 22a. Return-Code
| Desc | Value |
| - | - |
| Type | `int` |
[^1]: Created by _shell-docs-gen.sh_ _v1.5_ on Thu Nov 2 17:04:25 UTC 2017.
......@@ -2,7 +2,7 @@
###############################################################################
# This file is part of the shell-docs-generator v1.4.1
# This file is part of the shell-docs-generator v1.5
#
# shell-docs-generator, a documentation generator for shell scripts based on
# comment tags like @brief, @return, etc. that are placed in front of a
......@@ -20,9 +20,9 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# @title shell-docs-generator Function Reference
# @title shell-docs-generator
# @author Andreas Unterkircher
# @version 1.4.1
# @version 1.5
# @license AGPLv3
set -u -e -o pipefail # exit-on-error, error on undeclared variables.
......@@ -33,7 +33,7 @@ shopt -s extglob
# helper variables
readonly PROG_NAME="$(basename "${BASH_SOURCE[0]}")"
readonly PROG_VERS="1.4.1"
readonly PROG_VERS="1.5"
declare -g -a CODE_SRC=()
declare -g -a MARKDOWN_RESULT=()
......@@ -52,6 +52,7 @@ declare -g -a ALLOWED_TAGS=(
'^title$'
'^license$'
'^todo$'
'^deprecated$'
)
declare -A STANZA=()
......@@ -95,11 +96,13 @@ sanitize ()
# @return int
parse_parameters ()
{
TEMP=$(getopt -n "${FUNCNAME[0]}" -o "dfhi:no:sv" --long "debug,force,help,input:,noop,output:,silent,verbose" -- "${@}")
local TEMP
TEMP="$(getopt -n "${FUNCNAME[0]}" -o "dfhi:no:sv" --long "debug,force,help,input:,noop,output:,silent,verbose" -- "${@}")"
RETVAL="${?}"
if [ "x${RETVAL}" != "x0" ] || \
is_empty "${TEMP}" || \
is_empty_str "${TEMP}" || \
[[ "${TEMP}" =~ invalid[[:blank:]]option ]]; then
fail "error parsing arguments, getopt returned '${RETVAL}'!"
exit 1
......@@ -164,6 +167,11 @@ parse_parameters ()
esac
done
# default output is to stdout - represented by a '-' dash character.
if ! [[ -v OUTPUT ]]; then
OUTPUT='-'
fi
return 0
}
......@@ -236,7 +244,7 @@ is_array ()
return 1
fi
if ! [[ "$(declare -p "${1}" 2>&1)" =~ ^declare[[:blank:]]+-(a|A)[[:blank:]]+ ]]; then
if ! [[ "$(declare -p "${1}" 2>&1)" =~ ^declare[[:blank:]]+-(a|A)r?[[:blank:]]+ ]]; then
return 1
fi
......@@ -244,6 +252,32 @@ is_array ()
}
# @function is_empty()
# @brief returns 0, if the provided string or array variable have
# a value of length of zero. Otherwise it returns 1.
# @param1 string|array $string
# @return int 0 on success, 1 on failure
is_empty ()
{
[ $# -eq 1 ] || return 1
if ! is_declared "${1}"; then
fail "Variable is not declared!"
return 1
fi
local -n VAR="${1}"
if ! is_array "${1}"; then
[ -z "${VAR}" ] || return 1
return 0
fi
[ "${#VAR[@]}" -eq 0 ] || return 1
return 0
}
# @function is_empty_str()
# @brief This function is actually just a wrapper around
# the already simple zero-length-string-test 'test -z'.
# But this wrapper helps to make the rest of the code a bit easier
......@@ -251,7 +285,7 @@ is_array ()
# If the string is empty, it returns 0. Otherwise it returns 1.
# @param1 string var-name
# @return int
is_empty ()
is_empty_str ()
{
if [ $# -ne 1 ]; then
fail "Invalid parameters"
......@@ -263,6 +297,19 @@ is_empty ()
return 0
}
# @function is_declared()
# @brief returns 0 if the provided variable has been declared (that
# does not mean, that the variable actually has a value!), otherwise
# it returns 1.
# @param1 string $var
# @return int 0 on success, 1 on failure
is_declared ()
{
[ $# -eq 1 ] || return 1
declare -p "${1}" &> /dev/null
return $?
}
# @function is_allowed_tag()
# @brief This function tests the provided tag-name for any match
# in the ALLOWED_TAGS array. On success, it returns 0. Otherwise
......@@ -272,7 +319,7 @@ is_empty ()
is_allowed_tag ()
{
if [ $# -ne 1 ] || \
is_empty "${1}"; then
is_empty_str "${1}"; then
fail "Invalid parameters"
return 1
fi
......@@ -290,7 +337,7 @@ is_allowed_tag ()
is_cmd ()
{
if [ $# -ne 1 ] || \
is_empty "${1}"; then
is_empty_str "${1}"; then
fail "Invalid parameters"
return 1
fi
......@@ -306,7 +353,7 @@ is_cmd ()
is_debug ()
{
[[ -v DEBUG ]] || return 1;
! is_empty "${DEBUG}" || return 1;
! is_empty_str "${DEBUG}" || return 1;
[ "x${DEBUG}" != "x0" ] || return 1;
return 0
......@@ -383,6 +430,12 @@ mdout ()
return 1
fi
# just echo to stdout
if [ "${OUTPUT}" == '-' ]; then
echo "${1}"
return 0
fi
echo "${1}" >>"${OUTPUT}"
}
......@@ -499,7 +552,7 @@ parse_input ()
fi
debug "Found new stanza for function: ${BASH_REMATCH[1]}()"
! is_empty "${BASH_REMATCH[1]}" || continue
! is_empty_str "${BASH_REMATCH[1]}" || continue
CUR_FUNC="${BASH_REMATCH[1]}"
# test if the same function has already been handled before.
......@@ -589,7 +642,7 @@ parse_input ()
fi
# tags with empty values we do not need to record.
! is_empty "${CUR_VAL}" || { debug "Tag: ${CUR_TAG}, with empty value skipped."; continue; }
! is_empty_str "${CUR_VAL}" || { debug "Tag: ${CUR_TAG}, with empty value skipped."; continue; }
debug "Tag found: ${CUR_TAG}, value: '${CUR_VAL}'"
STANZA[${CUR_TAG}]="${CUR_VAL}"
......@@ -597,6 +650,39 @@ parse_input ()
done
}
# @function ascii_to_int()
# @brief Converts a single ASCII character to its decimal representation.
# @param1 string $ascii
# @output int
# @example echo $(ascii_to_int A) --> 65
# @return int
ascii_to_int ()
{
if [ $# -ne 1 ] || ! [[ "${1}" =~ ^[[:alnum:]]$ ]]; then
fail "Invalid parameters"
return 1
fi
printf '%d' "'${1}"
}
# @function int_to_ascii()
# @brief Converts a decimal value to its corresponding ASCII character.
# @param1 int $i
# @output string
# @example echo $(int_to_ascii 65) --> A
# @return int
int_to_ascii ()
{
if [ $# -ne 1 ] || ! [[ "${1}" =~ ^[[:digit:]]{1,3}$ ]]; then
fail "Invalid parameters"
return 1
fi
#shellcheck disable=SC2059
printf \\x"$(printf '%02x' "${1}")"
}
# @function formated_output()
# @brief This function performs the actual output of the generated
# documentation into the $OUTPUT file.
......@@ -611,10 +697,13 @@ formated_output ()
return 1
fi
local -n FUNC_STANZA=$1
local -n FUNC_STANZA="${1}"
local SECTION_CNT
SECTION_CNT="$(ascii_to_int 'a')"
if ! [[ -v "FUNC_STANZA['function']" ]]; then
fail "Unable to perform, if no @function tag is provided!"
fail "Unable to perform, no @function tag is found!"
return 1
fi
......@@ -627,7 +716,12 @@ formated_output ()
write "## ${FUNC_CNT}. Function \`${FUNC_STANZA['function']}\`"
write ""
# description block
if [[ -v "FUNC_STANZA['deprecated']" ]]; then
write "**!!! This function is marked _deprecated_ !!!**"
write ""
fi
# description section
if [[ -v "FUNC_STANZA['author']" ]] || [[ -v "FUNC_STANZA['version']" ]]; then
[[ -v "FUNC_STANZA['author']" ]] && write "Author: ${FUNC_STANZA['author']}"
[[ -v "FUNC_STANZA['version']" ]] && write "Version: ${FUNC_STANZA['version']}"
......@@ -639,8 +733,9 @@ formated_output ()
write ""
fi
# parameter section
if [[ -v "FUNC_STANZA['param1']" ]]; then
write "### ${FUNC_CNT}a. Parameters"
write "### ${FUNC_CNT}$(int_to_ascii "${SECTION_CNT}"). Parameters"
write ""
write "| ID | Type | Description |"
write "| - | - | - |"
......@@ -660,41 +755,64 @@ formated_output ()
done
write ""
((SECTION_CNT++))
fi
if [[ -v "FUNC_STANZA['output']" ]]; then
write "*Outputs*: ${FUNC_STANZA['output']}"
write "### ${FUNC_CNT}$(int_to_ascii "${SECTION_CNT}"). Output"
write ""
write "\`${FUNC_STANZA['output']}\`"
write ""
fi
if [[ -v "FUNC_STANZA['return']" ]]; then
if [[ "${FUNC_STANZA['return']}" =~ ^([[:alnum:]]+)[[:blank:]]*([[:print:]]*)$ ]]; then
write "### ${FUNC_CNT}b. Returns"; write ""
write "Type: \`${BASH_REMATCH[1]}\`"
if [ ${#BASH_REMATCH[@]} -eq 3 ] && ! is_empty "${BASH_REMATCH[2]}"; then
write "### ${FUNC_CNT}$(int_to_ascii "${SECTION_CNT}"). Return-Code"
write ""
write "${BASH_REMATCH[2]}"
write "| Desc | Value |"
write "| - | - |"
write "| Type | \`${BASH_REMATCH[1]}\` |"
if [ ${#BASH_REMATCH[@]} -eq 3 ] && ! is_empty_str "${BASH_REMATCH[2]}"; then
write "| Value | ${BASH_REMATCH[2]} |"
fi
write ""
fi
((SECTION_CNT++))
fi
if [[ -v "FUNC_STANZA['example']" ]]; then
write "### ${FUNC_CNT}$(int_to_ascii "${SECTION_CNT}"). Example"
write ""
write "\`\`\`"
write ""
write "${FUNC_STANZA['example']}"
write ""
write "\`\`\`"
write ""
((SECTION_CNT++))
fi
if [[ -v "FUNC_STANZA['see']" ]] || [[ -v "FUNC_STANZA['link']" ]]; then
[[ -v "FUNC_STANZA['see']" ]] && write "See: ${FUNC_STANZA['see']}"
[[ -v "FUNC_STANZA['link']" ]] && write "Link: ${FUNC_STANZA['link']}"
if [[ -v "FUNC_STANZA['see']" ]] || \
[[ -v "FUNC_STANZA['link']" ]] || \
[[ -v "FUNC_STANZA['todo']" ]]; then
write "### ${FUNC_CNT}$(int_to_ascii "${SECTION_CNT}"). Additional Information"
write ""
if [[ -v "FUNC_STANZA['see']" ]]; then
write "See: [${FUNC_STANZA['see']}]"
fi
if [[ -v "FUNC_STANZA['link']" ]]; then
write "Link: [${FUNC_STANZA['link']}]"
fi
if [[ -v "FUNC_STANZA['todo']" ]]; then
write "Todo: ${FUNC_STANZA['todo']}"
fi
write ""
((SECTION_CNT++))
fi
}
......@@ -762,12 +880,14 @@ output_markdown ()
fi
# in case this also truncates an existing file.
if [ "${OUTPUT}" != '-' ]; then
echo -n >"${OUTPUT}"
fi
if [[ -v CODE_TITLE ]]; then
mdout "# ${CODE_TITLE}"
else
mdout "# ${BASH_SOURCE[0]} Function Reference"
mdout "# Function Reference $(basename "${INPUT}")"
fi
mdout ""
......@@ -780,6 +900,9 @@ output_markdown ()
[[ -v CODE_LICENSE ]] && mdout "| License | ${CODE_LICENSE} |"
fi
mdout ""
mdout "<!-- if a table-of-contents gets actually rendered, depends on your markdown-viewer -->"
mdout "[TOC]"
mdout ""
for IDX in "${!MARKDOWN_RESULT[@]}"; do
......@@ -804,7 +927,7 @@ if ! [[ -v INPUT ]] || ! [[ -v OUTPUT ]]; then
exit 0
fi
if [ -e "${OUTPUT}" ] && ! [[ -v FORCE ]]; then
if [ "${OUTPUT}" != '-' ] && [ -e "${OUTPUT}" ] && ! [[ -v FORCE ]]; then
echo "WARNING: The output file already exists!"
REPLY=
......@@ -826,6 +949,6 @@ parse_input || \
output_markdown || \
{ fail "output_markdown() exited non-zero! Exiting."; exit 1; }
if [[ -v VERBOSE ]]; then
if [ "${OUTPUT}" != '-' ] && [[ -v VERBOSE ]]; then
cat "${OUTPUT}"
fi
#!/bin/bash
. common.sh
assert_func is_declared $TEST_TRUE $TEST_EMPTY LOGNAME
unset -v SOME_UNKNOWN_VARIABLE
assert_func is_declared $TEST_FALSE $TEST_EMPTY SOME_UNKNOWN_VARIABLE
assert_func is_declared $TEST_FALSE $TEST_EMPTY
#!/bin/bash
. common.sh
assert_func is_empty "${TEST_FAIL}" "Invalid[[:blank:]]parameters"
assert_func is_empty "${TEST_FAIL}" "Invalid[[:blank:]]parameters" foo bar
assert_func is_empty "${TEST_OK}" "${TEST_EMPTY}" ''
assert_func is_empty "${TEST_OK}" "${TEST_EMPTY}" ""
assert_func is_empty "${TEST_FAIL}" "${TEST_EMPTY}" "foo"
#!/bin/bash
. common.sh
assert_func is_empty "${TEST_FAIL}" "${TEST_EMPTY}"
assert_func is_empty "${TEST_FAIL}" "${TEST_EMPTY}" '/tmp' 'bla'
assert_func is_empty "${TEST_FAIL}" "Variable[[:blank:]]is[[:blank:]]not[[:blank:]]declared" ''
assert_func is_empty "${TEST_FAIL}" "Variable[[:blank:]]is[[:blank:]]not[[:blank:]]declared" 'foo'
declare -g -a TESTARY=()
assert_func is_empty "${TEST_OK}" "${TEST_EMPTY}" TESTARY
TESTARY+=( 'foo' )
assert_func is_empty "${TEST_FAIL}" "${TEST_EMPTY}" TESTARY
TESTARY+=( 'bar' )
assert_func is_empty "${TEST_FAIL}" "${TEST_EMPTY}" TESTARY
unset -v TESTARY
declare -g -A TESTARY=()
assert_func is_empty "${TEST_OK}" "${TEST_EMPTY}" TESTARY
TESTARY+=( ['key0']='foo' )
assert_func is_empty "${TEST_FAIL}" "${TEST_EMPTY}" TESTARY
TESTARY+=( ['key1']='bar' )
assert_func is_empty "${TEST_FAIL}" "${TEST_EMPTY}" TESTARY
unset -v TESTARY
#!/bin/bash
. common.sh
assert_func is_empty_str "${TEST_FAIL}" "Invalid[[:blank:]]parameters"
assert_func is_empty_str "${TEST_FAIL}" "Invalid[[:blank:]]parameters" '/tmp' 'bla'
assert_func is_empty_str "${TEST_OK}" "${TEST_EMPTY}" ''
assert_func is_empty_str "${TEST_FAIL}" "${TEST_EMPTY}" 'foo'
#!/bin/bash
. common.sh
assert_func ascii_to_int "${TEST_FAIL}" "Invalid[[:blank:]]parameter"
assert_func ascii_to_int "${TEST_FAIL}" "Invalid[[:blank:]]parameter" 'a' 'b'
assert_func ascii_to_int "${TEST_FAIL}" "Invalid[[:blank:]]parameter" 'abc'
assert_func ascii_to_int "${TEST_FAIL}" "Invalid[[:blank:]]parameter" '!'
assert_func ascii_to_int "${TEST_FAIL}" "Invalid[[:blank:]]parameter" '!!!'
assert_func ascii_to_int "${TEST_OK}" "65" 'A'
assert_func ascii_to_int "${TEST_OK}" "97" 'a'
assert_func ascii_to_int "${TEST_OK}" "49" '1'
assert_func ascii_to_int "${TEST_OK}" "57" '9'
#!/bin/bash
. common.sh
assert_func int_to_ascii "${TEST_FAIL}" 'Invalid[[:blank:]]parameter'
assert_func int_to_ascii "${TEST_FAIL}" 'Invalid[[:blank:]]parameter' 'a' 'b'
assert_func int_to_ascii "${TEST_FAIL}" 'Invalid[[:blank:]]parameter' 'abc'
assert_func int_to_ascii "${TEST_FAIL}" 'Invalid[[:blank:]]parameter' '1' '2'
assert_func int_to_ascii "${TEST_FAIL}" 'Invalid[[:blank:]]parameter' '1234'
assert_func int_to_ascii "${TEST_FAIL}" 'Invalid[[:blank:]]parameter' '!'
assert_func int_to_ascii "${TEST_FAIL}" 'Invalid[[:blank:]]parameter' '!!!'
assert_func int_to_ascii "${TEST_OK}" 'A' '65'
assert_func int_to_ascii "${TEST_OK}" 'a' '97'
assert_func int_to_ascii "${TEST_OK}" '1' '49'
......@@ -6,6 +6,6 @@ assert_func formated_output "${TEST_FAIL}" "Invalid[[:blank:]]parameters"
assert_func formated_output "${TEST_FAIL}" "Invalid[[:blank:]]parameters" foo
assert_func formated_output "${TEST_FAIL}" "Invalid[[:blank:]]parameters" foo bar
declare -A FOOBAR=()
assert_func formated_output "${TEST_FAIL}" "Unable[[:blank:]]to[[:blank:]]perform,[[:blank:]]if[[:blank:]]no" FOOBAR
assert_func formated_output "${TEST_FAIL}" "Unable[[:blank:]]to[[:blank:]]perform,[[:blank:]]no[[:blank:]]@function[[:blank:]]tag[[:blank:]]is[[:blank:]]found" FOOBAR
FOOBAR+=( ['function']="bla" )
assert_func formated_output "${TEST_OK}" "${TEST_EMPTY}" FOOBAR