aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Badour <bbadour@google.com>2020-05-18 16:52:16 -0700
committerBob Badour <bbadour@google.com>2020-05-18 17:29:34 -0700
commit2e0d635a8717e638eab0cd04e2596a90299c5c5c (patch)
treeda581028905318f358769fc7bb6f8aa7373e2fb7
parent43e4f53668c5840da1f51260a899cdb19394284b (diff)
parent7d0daf1b3b3163c34e0108cdb439e2cd2f148152 (diff)
downloadshflags-2e0d635a8717e638eab0cd04e2596a90299c5c5c.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into mymerge
The version of shflags we have now includes a file with an erroneous LGPL license header even after the author relicensed under Apache2. Bug: 68860345 Bug: 69058154 Bug: 151953481 Test: manual build Test: treehugger Change-Id: Ifc31394445d94248473d60b011fa76f66985e0b4
-rwxr-xr-x.githooks/generic33
-rwxr-xr-x.githooks/pre-commit.shellcheck41
-rw-r--r--.travis.yml37
-rw-r--r--Android.bp2
-rw-r--r--CODE_OF_CONDUCT.md46
-rw-r--r--CONTRIBUTING.md116
-rw-r--r--METADATA20
-rw-r--r--README.md15
-rwxr-xr-xbin/cb_wrapper.sh1
-rwxr-xr-xbin/continuous_build.sh126
-rw-r--r--bin/gen_test_results.flags5
-rwxr-xr-xbin/gen_test_results.sh79
-rw-r--r--doc/CHANGES-1.0.md97
-rw-r--r--doc/CHANGES-1.2.md189
-rw-r--r--doc/CHANGES-1.3.md171
-rw-r--r--doc/RELEASE_NOTES-1.2.0.md2
-rw-r--r--doc/RELEASE_NOTES-1.2.1.md66
-rw-r--r--doc/RELEASE_NOTES-1.2.2.md72
-rw-r--r--doc/RELEASE_NOTES-1.2.3.md67
-rw-r--r--doc/coding_standards.txt118
-rw-r--r--doc/contributors.txt5
-rw-r--r--doc/rst2html.css292
-rwxr-xr-xexamples/debug_output.sh16
-rwxr-xr-xexamples/hello_world.sh8
-rwxr-xr-xexamples/write_date.sh47
-rwxr-xr-xinit_githooks.sh47
-rw-r--r--lib/shlib34
-rwxr-xr-x[-rw-r--r--]lib/shunit2976
-rwxr-xr-xlib/versions264
-rw-r--r--shflags (renamed from lib/shflags)606
-rwxr-xr-xshflags_defines_test.sh218
-rwxr-xr-xshflags_parsing_test.sh333
-rwxr-xr-xshflags_private_test.sh317
-rwxr-xr-xshflags_public_test.sh242
-rw-r--r--shflags_test_helpers137
-rw-r--r--src/shflags1155
-rwxr-xr-xsrc/shflags_test.sh116
-rwxr-xr-xsrc/shflags_test_defines.sh217
-rw-r--r--src/shflags_test_helpers116
-rwxr-xr-xsrc/shflags_test_parsing.sh365
-rwxr-xr-xsrc/shflags_test_private.sh247
-rwxr-xr-xsrc/shflags_test_public.sh180
-rw-r--r--test_results/1.0.1/Linux-Ubuntu_Dapper-6.06.txt430
-rw-r--r--test_results/1.0.1/Linux-Ubuntu_Hardy-8.04.txt512
-rw-r--r--test_results/1.0.1/Mac_OS_X-10.5.4.txt368
-rw-r--r--test_results/1.0.1/Solaris-9-U6-x86.txt366
-rw-r--r--test_results/1.0.1/Solaris-nv-77-x86.txt366
-rw-r--r--test_results/1.0.2/Linux-Red_Hat_Linux_release_9_(Shrike).txt214
-rw-r--r--test_results/1.0.2/Linux-Ubuntu-6.06.txt328
-rw-r--r--test_results/1.0.2/Linux-Ubuntu-8.04.txt379
-rw-r--r--test_results/1.0.2/Mac_OS_X-10.5.5.txt291
-rw-r--r--test_results/1.0.2/Solaris-11.txt283
-rw-r--r--test_results/1.0.3/Linux-Ubuntu-6.06.txt348
-rw-r--r--test_results/1.0.3/Linux-Ubuntu-8.04.txt409
-rw-r--r--test_results/1.0.3/Mac_OS_X-10.5.6.txt287
-rw-r--r--test_results/1.0.3/Solaris-5.11-NexentaOS_20081207.txt235
-rw-r--r--test_results/1.0.3/Solaris-5.11-snv_77.txt287
-rw-r--r--test_results/1.2.0/FreeBSD-9.1.txt111
-rw-r--r--test_results/1.2.0/Linux-Ubuntu-10.04.4-LTS.txt451
-rw-r--r--test_results/1.2.0/Linux-Ubuntu-12.04.1-LTS.txt451
-rw-r--r--test_results/1.2.0/Linux-Ubuntu-14.04.3-LTS.txt451
-rw-r--r--test_results/1.2.0/Linux-Ubuntu-8.04.4-LTS.txt451
-rw-r--r--test_results/1.2.0/Mac_OS_X-10.10.3.txt315
-rw-r--r--test_results/1.2.0/Mac_OS_X-10.8.2.txt315
-rw-r--r--test_results/1.2.0/OpenSolaris-2009.06(snv_111b).txt247
-rw-r--r--test_results/1.2.0/Solaris-10u10.txt316
-rw-r--r--test_results/1.2.0/Solaris-8u7.txt316
-rw-r--r--test_results/1.2.0/Solaris-9u8.txt316
-rwxr-xr-xtest_runner191
69 files changed, 3571 insertions, 12704 deletions
diff --git a/.githooks/generic b/.githooks/generic
new file mode 100755
index 0000000..6f903dc
--- /dev/null
+++ b/.githooks/generic
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# A generic git hook proxy.
+# https://git-scm.com/docs/githooks
+
+run() {
+ hook=$1
+ file=$2
+
+ n=$(echo "${file}" |sed "s/^.*${hook}\.//")
+ echo "running ${n} ${hook}"
+ ${file}
+}
+
+die() {
+ hook=$1
+ echo "${hook} hook did not succeed" >&2
+ exit 1
+}
+
+# Redirect output to stderr.
+exec 1>&2
+
+githooks='.githooks'
+basename=$(basename "$0")
+
+for f in $(cd ${githooks} && echo *); do
+ case "${f}" in
+ ${basename}.*)
+ run ${basename} "${githooks}/${f}" || die "${f}"
+ ;;
+ esac
+done
diff --git a/.githooks/pre-commit.shellcheck b/.githooks/pre-commit.shellcheck
new file mode 100755
index 0000000..f218922
--- /dev/null
+++ b/.githooks/pre-commit.shellcheck
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Git hook to run ShellCheck.
+#
+# ShellCheck <https://www.shellcheck.net/>
+
+# Treat unset variables as an error when performing parameter expansion.
+set -u
+
+TRUE=0
+FALSE=1
+
+die() {
+ echo "$@" >&2
+ exit 1
+}
+
+if ! command -v shellcheck >/dev/null; then
+ echo 'unable to locate shellcheck' >&2
+ return 0
+fi
+
+success=${TRUE}
+for f in $(git diff --cached --name-only); do
+ # Check for file deletion.
+ if [ ! -r "${f}" ]; then
+ continue
+ fi
+
+ cmd=':'
+ case "${f}" in
+ shflags|shflags_test_helpers) cmd="shellcheck -s sh ${f}" ;;
+ *.sh) cmd="shellcheck ${f}" ;;
+ esac
+ if ! ${cmd}; then
+ success=${FALSE}
+ echo "shellcheck error for '${f}'" >&2
+ fi
+done
+
+exit ${success}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..3329b77
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,37 @@
+language: bash
+
+env:
+ - SHUNIT_COLOR='always'
+
+script:
+ # Execute the unit tests.
+ - ./test_runner
+
+addons:
+ apt:
+ packages:
+ - ksh
+ - mksh
+ - zsh
+
+matrix:
+ include:
+ - os: linux
+ dist: bionic # Ubuntu Bionic 18.04 (EoL Apr 2028).
+ - os: linux
+ dist: xenial # Ubuntu Xenial 16.04 (EoL Apr 2024).
+ - os: linux
+ dist: trusty # Ubuntu Trusty 14.04 (EoL Apr 2022).
+ - os: osx
+ - os: linux
+ script:
+ # Run the source through ShellCheck (http://www.shellcheck.net).
+ - shellcheck *_test.sh
+ - shellcheck -s sh shflags shflags_test_helpers
+
+branches:
+ only:
+ - master
+ - 1.0.x
+ # Tags, e.g. v.1.2.3.
+ - /^v\d+\.\d+(\.\d+)?(-\S*)?$/
diff --git a/Android.bp b/Android.bp
index 5e5382e..60ee318 100644
--- a/Android.bp
+++ b/Android.bp
@@ -19,7 +19,7 @@ cc_prebuilt_binary {
device_supported: false,
host_supported: true,
- srcs: ["src/shflags"],
+ srcs: ["shflags"],
relative_install_path: "lib/shflags",
}
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..dc906ab
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at kate.ward@forestent.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..55db597
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,116 @@
+# Coding Standards
+
+shFlags is more than just a simple 20 line shell script. It is a significant library of shell code that at first glance might not seam easy to understand. To improve code readability and usability, these guidelines are followed to help make the code more understandable for anyone who wants to read or modify it.
+
+[TOC]
+
+## Function declaration
+
+Declare functions using the following form:
+
+```sh
+doSomething() {
+ echo 'done!'
+}
+```
+
+One-line functions are allowed if they are for a single command.
+
+```sh
+doSomething() { echo 'done!'; }
+```
+
+## Function documentation
+
+Each function should be preceded by a header that provides the following:
+
+1. A one-sentence summary of what the function does.
+
+1. (optional) A longer description of what the function does, and perhaps some special information that helps convey its usage better.
+
+1. Args: a one-line summary of each argument of the form:
+
+ `name: type: description`
+
+1. Output: a one-line summary of the output provided. Only output to STDOUT must be documented, unless the output to STDERR is of significance (i.e. not just an error message). The output should be of the form:
+
+ `type: description`
+
+1. Returns: a one-line summary of the value returned. Returns in shell are always integers, but if the output is a true/false for success (i.e. a boolean), it should be noted. The output should be of the form:
+
+ `type: description`
+
+Here is a sample header:
+
+```
+# Return valid getopt options using currently defined list of long options.
+#
+# This function builds a proper getopt option string for short (and long)
+# options, using the current list of long options for reference.
+#
+# Args:
+# _flags_optStr: integer: option string type (__FLAGS_OPTSTR_*)
+# Output:
+# string: generated option string for getopt
+# Returns:
+# boolean: success of operation (always returns True)
+```
+
+## Variable and function names
+
+All shFlags specific constants, variables, and functions will be prefixed appropriately with `flags`. This is to distinguish usage in the shFlags code from users own scripts so that the shell name space remains predictable to users. The exceptions here are the standard `assertEquals`, etc., functions.
+
+All non built-in constants and variables will be surrounded with squiggle brackets, e.g. `${flags_someVariable}` to improve code readability.
+
+Due to some shells not supporting local variables in functions, care in the naming and use of variables, both public and private, is very important. Accidental overriding of the variables can occur easily if care is not taken as all variables are technically global variables in some shells.
+
+Type | Sample
+-------------------------------- | ---------------------
+global public constant | `FLAGS_TRUE`
+global private constant | `__FLAGS_SHELL_FLAGS`
+global public variable | `flags_variable`
+global private variable | `__flags_variable`
+global macro | `_FLAGS_SOME_MACRO_`
+public function | `flags_function`
+public function, local variable | `flags_variable_`
+private function | `_flags_function`
+private function, local variable | `_flags_variable_`
+
+Where it makes sense to improve readability, variables can have the first letter of the second and later words capitalized. For example, the local variable name for the help string length is `flags_helpStrLen_`.
+
+There are three special-case global public variables used. They are used due to overcome the limitations of shell scoping or to prevent forking. The three variables are:
+
+- `flags_error`
+- `flags_output`
+- `flags_return`
+
+## Local variable cleanup
+
+As many shells do not support local variables, no support for cleanup of variables is present either. As such, all variables local to a function must be cleared up with the `unset` built-in command at the end of each function.
+
+## Indentation
+
+Code block indentation is two (2) spaces, and tabs may not be used.
+
+```sh
+if [ -z 'some string' ]; then
+ someFunction
+fi
+```
+
+Lines of code have no line limit, although the general preference is to wrap lines at reasonable boundaries (e.g., between if/then/else clauses). When long lines are wrapped using the backslash character '\', subsequent lines should be indented with four (4) spaces so as to differentiate from the standard spacing of two characters, and tabs may not be used.
+
+```sh
+for x in some set of very long set of arguments that make for a very long \
+ that extends much too long for one line
+do
+ echo ${x}
+done
+```
+
+When a conditional expression is written using the built-in `[` command, and that line must be wrapped, place the control `||` or `&&` operators on the same line as the expression where possible, with the list to be executed on its own line.
+
+```sh
+[ -n 'some really long expression' -a -n 'some other long expr' ] && \
+ echo 'that was actually true!'
+```
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..c784bbe
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,20 @@
+name: "shFlags"
+description:
+ "shFlags is a port of the Google gflags library for Unix shell. The code is "
+ "written in a way to be as portable as possible to work across a wide array "
+ "of Unix variants. It is also tested with shUnit2 to maintain code quality."
+
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://github.com/kward/shflags/wiki"
+ }
+ url {
+ type: GIT
+ value: "https://github.com/kward/shflags"
+ }
+ version: "7d0daf1b3b3163c34e0108cdb439e2cd2f148152"
+ last_upgrade_date { year: 2020 month: 5 day: 18 }
+ license_type: NOTICE
+}
+
diff --git a/README.md b/README.md
index e34af2b..d26e6f8 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
-shFlags README
-==============
+# shFlags README
-shFlags is a port of the Google [gflags](http://gflags.github.io/gflags/)
-library for Unix shell. The code is written in a way to be as portable as
-possible to work across a wide array of Unix variants. It is also tested with
-[shUnit2](https://github.com/kward/shunit2) to maintain code quality.
+shFlags is a port of the Google [gflags](http://gflags.github.io/gflags/) library for Unix shell. The code is written in a way to be as portable as possible to work across a wide array of Unix variants. It is also tested with [shUnit2](https://github.com/kward/shunit2) to maintain code quality.
If you'd like to use shFlags, feel free to read the documentation.
-https://github.com/kward/shflags/wiki/Documentation10x
+https://github.com/kward/shflags/wiki/Documentation12x
+
+[![Travis CI][travis-ci-png]][travis-ci]
+
+[travis-ci-png]: https://travis-ci.org/kward/shflags.png?branch=master
+[travis-ci]: https://travis-ci.org/kward/shflags
diff --git a/bin/cb_wrapper.sh b/bin/cb_wrapper.sh
deleted file mode 100755
index 418dd93..0000000
--- a/bin/cb_wrapper.sh
+++ /dev/null
@@ -1 +0,0 @@
-../bin/continuous_build.sh -c ./shflags_test.sh -w shflags -O ~/tmp
diff --git a/bin/continuous_build.sh b/bin/continuous_build.sh
deleted file mode 100755
index 6f47c69..0000000
--- a/bin/continuous_build.sh
+++ /dev/null
@@ -1,126 +0,0 @@
-# /bin/sh
-# $Id$
-# vim:et:ft=sh:sts=2:sw=2
-#
-# Copyright 2010 Kate Ward. All Rights Reserved.
-# Author: kate.ward@forestent.com (Kate Ward)
-#
-# Continuous build script for shell library testing.
-#
-# Sample usages:
-# $ blah
-
-# treat unset variables as an error
-set -u
-
-# global constants
-ARGV0=`basename "$0"`
-ARGV0_DIR=`dirname "$0"`
-SHLIB_DIR="${ARGV0_DIR}/../lib"
-
-# load libraries
-. ${SHFLAGS_LIB:-${SHLIB_DIR}/shflags} \
- || (echo 'unable to load shflags library' >&2; exit 1)
-. ${VERSIONS_LIB:-${SHLIB_DIR}/versions} \
- || (echo 'unable to load versions library' >&2; exit 1)
-
-OUTPUT_FILE="${VERSIONS_OS_NAME}_${VERSIONS_OS_RELEASE}"
-
-# define flags
-DEFINE_string 'command' '' 'the command to start a build' 'c'
-DEFINE_string 'watch' '' 'file to watch for changes' 'w'
-DEFINE_string 'watch_from' '' 'file containing filenames to watch' 'W'
-DEFINE_string 'output' "${OUTPUT_FILE}" 'output file to write to' 'o'
-DEFINE_string 'output_dir' '.' 'directory to write output file' 'O'
-DEFINE_integer 'pause' 60 'pause between successive runs (sec)' 'p'
-
-FLAGS_HELP="USAGE: ${ARGV0} [flags]"
-
-#------------------------------------------------------------------------------
-# functions
-#
-
-# This function exits the script, optionally printing a message
-#
-# Args:
-# message: string: an error message to be output (optional)
-# Output:
-# string: usable flags
-die() {
- [ $# -ne 0 ] && echo "$@" >&2
- flags_help
- exit 1
-}
-
-# Function to give the current date in ISO format
-#
-# Args:
-# none
-# Output:
-# string: isodate
-isodate() {
- date -u '+%Y%m%dT%H%M%SZ'
-}
-
-age() {
- awkScript=''
- case ${VERSIONS_OS_NAME} in
- FreeBSD|Solaris) awkScript='{print $6,$7,$8}' ;;
- Linux) awkScript='{print $6,$7}' ;;
- *) echo "unrecognized OS name (${VERSIONS_OS_NAME})" >&2 ;;
- esac
- ls -l "$1" |awk "${awkScript}"
-}
-
-#------------------------------------------------------------------------------
-# main
-#
-
-main()
-{
- # checks
- [ -n "${FLAGS_command}" ] || die 'command required'
- [ -z "${FLAGS_watch}" -a -z "${FLAGS_watch_from}" ] \
- && die 'one of watch or watch_from required'
- [ -n "${FLAGS_watch}" -a -n "${FLAGS_watch_from}" ] \
- && die 'only one of watch or watch_from can be specified'
- [ -r "${FLAGS_watch}" ] || die 'unable to read watch file'
- [ -w "${FLAGS_output_dir}" ] || die 'unable to write to output directory'
-
- watchAge=`age "${FLAGS_watch}"`
- watchAgePrev=${watchAge}
-
- # build
- while true; do
- if [ ! "${watchAge}" == "${watchAgePrev}" ]; then
- date=`isodate`
- echo "building ${VERSIONS_OS_NAME}-${VERSIONS_OS_RELEASE} @ ${date}"
- outputFileDated="${FLAGS_output}-${date}"
- ${FLAGS_command} >"${FLAGS_output_dir}/${outputFileDated}" 2>&1
-
- ( cd "${FLAGS_output_dir}";
- rm -f "${FLAGS_output}";
- ln -s "${outputFileDated}" "${FLAGS_output}";
- grep FAIL "${FLAGS_output}"; )
-
- watchAgePrev=${watchAge}
- fi
-
- watchAge=`age "${FLAGS_watch}"`
- if [ "${watchAge}" == "${watchAgePrev}" ]; then
- echo 'sleeping...'
- while [ "${watchAge}" == "${watchAgePrev}" ]; do
- sleep ${FLAGS_pause}
- watchAge=`age "${FLAGS_watch}"`
- done
- fi
- done
-}
-
-# execute main() if this is run in standalone mode (i.e. not in a unit test)
-argv0=`echo "${ARGV0}" |sed 's/_test$//;s/_test\.sh$//'`
-if [ "${ARGV0}" = "${argv0}" ]; then
- FLAGS "$@" || exit $?
- eval set -- "${FLAGS_ARGV}"
- if [ $# -gt 0 ]; then main "$@"; else main; fi
-fi
diff --git a/bin/gen_test_results.flags b/bin/gen_test_results.flags
deleted file mode 100644
index 4efe4c3..0000000
--- a/bin/gen_test_results.flags
+++ /dev/null
@@ -1,5 +0,0 @@
-# vim:et:ft=sh:sts=2:sw=2
-#
-# Flag definition overrides for the gen_test_results.sh script.
-
-DEFINE_string suite 'shflags_test.sh' 'unit test suite' s
diff --git a/bin/gen_test_results.sh b/bin/gen_test_results.sh
deleted file mode 100755
index bfd1cf2..0000000
--- a/bin/gen_test_results.sh
+++ /dev/null
@@ -1,79 +0,0 @@
-#! /bin/sh
-# vim:et:ft=sh:sts=2:sw=2
-#
-# This script runs the provided unit tests and sends the output to the
-# appropriate file.
-
-# Treat unset variables as an error.
-set -u
-
-die() {
- [ $# -gt 0 ] && echo "error: $@" >&2
- exit 1
-}
-
-BASE_DIR="`dirname $0`/.."
-LIB_DIR="${BASE_DIR}/lib"
-
-# Load libraries.
-. ${LIB_DIR}/shflags || die 'unable to load shflags library'
-. ${LIB_DIR}/shlib || die 'unable to load shlib library'
-. ${LIB_DIR}/versions || die 'unable to load versions library'
-
-# Redefining BASE_DIR now that we have the shlib functions.
-BASE_DIR=`shlib_relToAbsPath "${BASE_DIR}"`
-BIN_DIR="${BASE_DIR}/bin"
-SRC_DIR="${BASE_DIR}/src"
-
-os_name=`versions_osName |sed 's/ /_/g'`
-os_version=`versions_osVersion`
-
-# Load external flags.
-. ${BIN_DIR}/gen_test_results.flags
-
-# Define flags.
-DEFINE_boolean force false 'force overwrite' f
-DEFINE_string output_dir "`pwd`" 'output dir' d
-DEFINE_string output_file "${os_name}-${os_version}.txt" 'output file' o
-DEFINE_boolean dry_run false "supress logging to a file" n
-
-main() {
- # Determine output filename.
- output="${FLAGS_output_dir:+${FLAGS_output_dir}/}${FLAGS_output_file}"
- output=`shlib_relToAbsPath "${output}"`
-
- # Checks.
- [ -n "${FLAGS_suite:-}" ] || die 'suite flag missing'
-
- if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} -a -f "${output}" ]; then
- if [ ${FLAGS_force} -eq ${FLAGS_TRUE} ]; then
- rm -f "${output}"
- else
- echo "not overwriting '${output}'" >&2
- exit ${FLAGS_ERROR}
- fi
- fi
- if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then
- touch "${output}" 2>/dev/null || die "unable to write to '${output}'"
- fi
-
- # Run tests.
- (
- cd "${SRC_DIR}";
- if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then
- ./${FLAGS_suite} |tee "${output}"
- else
- ./${FLAGS_suite}
- fi
- )
-
- if [ ! ${FLAGS_dry_run} ]; then
- echo >&2
- echo "output written to '${output}'" >&2
- fi
-}
-
-FLAGS "$@" || exit $?
-[ ${FLAGS_help} -eq ${FALSE} ] || exit
-eval set -- "${FLAGS_ARGV}"
-main "$@"
diff --git a/doc/CHANGES-1.0.md b/doc/CHANGES-1.0.md
index fd447cf..9437599 100644
--- a/doc/CHANGES-1.0.md
+++ b/doc/CHANGES-1.0.md
@@ -1,78 +1,21 @@
-Changes in shFlags
-==================
+# Changes in shFlags
-Changes with 1.2.0
-------------------
+## Changes with 1.0.3
-Changed from the LGPL v2.1 license to the Apache v2.0 license so that others
-can include the library or make changes without needing to release the modified
-source code as well.
-
-Moved documentation to Markdown.
-
-Migrated the code to GitHub as code.google.com is turning down.
-
-Fixed issue #10. Usage of `expr` under FreeBSD 7.2 (FreeNAS 0.7.1) and FreeBSD
-8.0 that was causing many unit tests to fail.
-
-Fixed issue where booleans were sometimes mis-configured to require additional
-values like other flags.
-
-Changed `_flags_fatal()` to exit with `FLAGS_ERROR` immediately.
-
-Fixed issue #11. When help is requested, the help flag is no longer prefixed
-with '[no]'.
-
-Upgraded shUnit2 to 2.1.6.
-
-Fixed issue #12. Requesting help shouldn't be considered an error.
-
-Added the ability to override the use of the OS default `getopt` command by
-defining the `FLAGS_GETOPT_CMD` variable.
-
-Updated `gen_test_results.sh` and versions from shUnit2 source.
-
-Fixed issues# 13, 14. Added support for dashes ('-') in long flag names. The
-defined flag will still be declared with underscores ('_') due to shell
-limitations, so only one of a dashed flag name or an underscored flag name are
-allowed, not both.
-
-Issue #20. Updated LGPL v2.1 license from
-http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
-
-Issue #15. Use `gexpr` instead of `expr` on BSD variants.
-
-Minor tweaks to make run on FreeBSD 9.1.
-
-Fixed issue in `shflags_test_public.sh` where screens >80 columns were causing a
-test to fail.
-
-Issue #22. Fixed broken testGetFlagInfo() test.
-
-Created alternate `validFloat()` and `validInt()` functions that use shell
-built-ins where possible to increase performance and reduce the usage of the
-`expr` command.
-
-Added separate built-in and `expr` functions for doing math.
-
-
-Changes with 1.0.3
-------------------
-
-MAJOR CHANGE! `FLAGS_ARGC` is now obsolete, and is replaced by
-`FLAGS_ARGV`. See below for more info.
+MAJOR CHANGE! `FLAGS_ARGC` is now obsolete, and is replaced by `FLAGS_ARGV`. See
+below for more info.
Fixed issue# 7 where long flags defined with '=' (e.g. `--abc=123`) made it
impossible for the user to know how many non-flag command-line arguments were
-available because the value returned by `FLAGS_ARGC` was wrong. The
-`FLAGS_ARGC` value is now obsolete, but will be maintained for backwards
-compatibility. The new method of getting the non-flag arguments is by executing
-`eval set -- "${FLAGS_ARGV}"` after the `FLAGS` call. The arguments will
-then be available using the standard shell $#, $@, $*, $1, etc. variables.
+available because the value returned by `FLAGS_ARGC` was wrong. The `FLAGS_ARGC`
+value is now obsolete, but will be maintained for backwards compatibility. The
+new method of getting the non-flag arguments is by executing `eval set --
+"${FLAGS_ARGV}"` after the `FLAGS` call. The arguments will then be available
+using the standard shell $#, $@, $*, $1, etc. variables.
-Due to above fix for issue# 7, there is now proper support for mixing flags
-with non-flag arguments on the command-line. Previously, all non-flag arguments
-had to be at the end of the command-line.
+Due to above fix for issue# 7, there is now proper support for mixing flags with
+non-flag arguments on the command-line. Previously, all non-flag arguments had
+to be at the end of the command-line.
Renamed `_flags_standardGetopt()` and `_flags_enhancedGetopt()` functions to
`_flags_getoptStandard()` and `_flags_getoptEnhanced()`.
@@ -97,9 +40,7 @@ Added the OS version to OS release for Solaris.
Fixed `flags_reset()` so it unsets the default value environment vars.
-
-Changes with 1.0.2
-------------------
+## Changes with 1.0.2
FLAGS_PARENT no longer transforms into a constant so that it can be defined at
run time in scripts.
@@ -119,8 +60,8 @@ Improved `assert[Warn|Error]Msg()` test helper grepping.
Replaced shell_versions.sh with a new versions library and created
`gen_test_results.sh` to make releases easier.
-Copied the coding standards from shUnit2, but haven't fully implemented them
-in shFlags yet.
+Copied the coding standards from shUnit2, but haven't fully implemented them in
+shFlags yet.
Issue# 1: When a user defines their own `--help` flag, no more warning is thrown
when `FLAGS()` is called stating that the help flag already defined.
@@ -129,9 +70,7 @@ Issue# 2: Passing the `--nohelp` option no longer gives help output.
Issue# 3: Added support for screen width detection.
-
-Changes with 1.0.1
-------------------
+## Changes with 1.0.1
Fixed bug where the help output added '[no]' to all flag names
@@ -148,8 +87,6 @@ execute the code in-line, but later. As such, variables that are defined in the
library cannot be used until functions are called from the main code. This
required the 'help' flag definition to be moved inside the FLAGS command.
-
-Changes with 1.0.0
-------------------
+## Changes with 1.0.0
This is the first official release, so everything is new.
diff --git a/doc/CHANGES-1.2.md b/doc/CHANGES-1.2.md
new file mode 100644
index 0000000..b128eb9
--- /dev/null
+++ b/doc/CHANGES-1.2.md
@@ -0,0 +1,189 @@
+# Changes in shFlags
+
+## Changes with 1.2.3
+
+Upgraded shUnit2 to 2.1.7.
+
+Fixed the examples to work again with the new code structure.
+
+Removed `gen_test_report.sh` as it isn't used anymore.
+
+Minor fix for `_flags_underscoreName()` to insure POSIX compliance.
+
+Cleanup of pre-GitHub cruft.
+
+Fixed bug in `_flags_columns()` where `stty size` sometimes gave unexpected
+output, causing the function to not work.
+
+Replaced `test_runner` with upstream from https://github.com/kward/shlib.
+
+## Changes with 1.2.2
+
+Ran all scripts through [ShellCheck](http://www.shellcheck.net/).
+
+Replaced `shflags_test.sh` with `test_runner` from
+https://github.com/kward/shlib.
+
+Fixed issue #45. Empty help string causes `shflags_test_issue_28.sh` to fail.
+
+Continuous integration testing setup with [Travis
+CI](https://travis-ci.org/kward/shflags).
+
+Restructured code to be more GitHub like.
+
+## Changes with 1.2.1
+
+Fixed issue #43. Added support for BusyBox `ash` shell.
+
+Fixed issues #26, #27. Re-factored `_flags_itemInList()` to use built-ins.
+
+Fixed issue #31. Documented newline support in FLAGS_HELP.
+
+Fixed issue #28. DEFINE_boolean misbehaves when help-string is empty.
+
+Fixed issue #25. Fix some typos.
+
+## Changes with 1.2.0
+
+Changed from the LGPL v2.1 license to the Apache v2.0 license so that others can
+include the library or make changes without needing to release the modified
+source code as well.
+
+Moved documentation to Markdown.
+
+Migrated the code to GitHub as http://code.google.com/ is turning down.
+
+Fixed issue #10. Usage of `expr` under FreeBSD 7.2 (FreeNAS 0.7.1) and FreeBSD
+8.0 that was causing many unit tests to fail.
+
+Fixed issue where booleans were sometimes mis-configured to require additional
+values like other flags.
+
+Changed `_flags_fatal()` to exit with `FLAGS_ERROR` immediately.
+
+Fixed issue #11. When help is requested, the help flag is no longer prefixed
+with '[no]'.
+
+Upgraded shUnit2 to 2.1.6.
+
+Fixed issue #12. Requesting help shouldn't be considered an error.
+
+Added the ability to override the use of the OS default `getopt` command by
+defining the `FLAGS_GETOPT_CMD` variable.
+
+Updated `gen_test_results.sh` and versions from shUnit2 source.
+
+Fixed issues# 13, 14. Added support for dashes '-' in long flag names. The
+defined flag will still be declared with underscores '\_' due to shell
+limitations, so only one of a dashed flag name or an underscored flag name are
+allowed, not both. (Backslash on \_ to prevent Markdown formatting.)
+
+Issue #20. Updated LGPL v2.1 license from
+http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
+
+Issue #15. Use `gexpr` instead of `expr` on BSD variants.
+
+Minor tweaks to make run on FreeBSD 9.1.
+
+Fixed issue in `shflags_test_public.sh` where screens >80 columns were causing a
+test to fail.
+
+Issue #22. Fixed broken testGetFlagInfo() test.
+
+Created alternate `validFloat()` and `validInt()` functions that use shell
+built-ins where possible to increase performance and reduce the usage of the
+`expr` command.
+
+Added separate built-in and `expr` functions for doing math.
+
+## Changes with 1.0.3
+
+MAJOR CHANGE! `FLAGS_ARGC` is now obsolete, and is replaced by `FLAGS_ARGV`. See
+below for more info.
+
+Fixed issue# 7 where long flags defined with '=' (e.g. `--abc=123`) made it
+impossible for the user to know how many non-flag command-line arguments were
+available because the value returned by `FLAGS_ARGC` was wrong. The `FLAGS_ARGC`
+value is now obsolete, but will be maintained for backwards compatibility. The
+new method of getting the non-flag arguments is by executing `eval set --
+"${FLAGS_ARGV}"` after the `FLAGS` call. The arguments will then be available
+using the standard shell $#, $@, $\*, $1, etc. variables. (Backslash on \* to
+prevent Markdown formatting.)
+
+Due to above fix for issue# 7, there is now proper support for mixing flags with
+non-flag arguments on the command-line. Previously, all non-flag arguments had
+to be at the end of the command-line.
+
+Renamed `_flags_standardGetopt()` and `_flags_enhancedGetopt()` functions to
+`_flags_getoptStandard()` and `_flags_getoptEnhanced()`.
+
+Took out the setting and restoration of the '-u' shell flag to treat unset
+variables as an error. No point in having it in this library as it is verified
+in the unit tests, and provides basically no benefit.
+
+Fixed bug under Solaris where the generated help was adding extra 'x'
+characters.
+
+Added checks for reserved flag variables (e.g. `FLAGS_TRUE`).
+
+Fixed some unset variable bugs.
+
+Now report the actual `getopt` error if there is one.
+
+All tests now properly enable skipping based on whether a standard or enhanced
+`getopt` is found.
+
+Added the OS version to OS release for Solaris.
+
+Fixed `flags_reset()` so it unsets the default value environment vars.
+
+## Changes with 1.0.2
+
+${FLAGS_PARENT} no longer transforms into a constant so that it can be defined
+at run time in scripts.
+
+Added warning about short flags being unsupported when there are problems
+parsing the options with `getopt`.
+
+Add default values to end of description strings.
+
+Fixed bug that returned an error instead of success when recalling the default
+values for empty strings.
+
+Added warning when a duplicate flag definition is attempted.
+
+Improved `assert[Warn|Error]Msg()` test helper grepping.
+
+Replaced shell_versions.sh with a new versions library and created
+`gen_test_results.sh` to make releases easier.
+
+Copied the coding standards from shUnit2, but haven't fully implemented them in
+shFlags yet.
+
+Issue# 1: When a user defines their own `--help` flag, no more warning is thrown
+when `FLAGS()` is called stating that the help flag already defined.
+
+Issue# 2: Passing the `--nohelp` option no longer gives help output.
+
+Issue# 3: Added support for screen width detection.
+
+## Changes with 1.0.1
+
+Fixed bug where the help output added '[no]' to all flag names
+
+Added additional example files that are referenced by the documentation.
+
+Improved `zsh` version and option checking.
+
+Upgraded shUnit2 to 2.1.4
+
+Added unit testing for the help output.
+
+When including a library (e.g. shflags) in a script, zsh 3.0.8 doesn't actually
+execute the code in-line, but later. As such, variables that are defined in the
+library cannot be used until functions are called from the main code. This
+required the 'help' flag definition to be moved inside the FLAGS command.
+
+## Changes with 1.0.0
+
+This is the first official release, so everything is new.
diff --git a/doc/CHANGES-1.3.md b/doc/CHANGES-1.3.md
new file mode 100644
index 0000000..248afe6
--- /dev/null
+++ b/doc/CHANGES-1.3.md
@@ -0,0 +1,171 @@
+# Changes in shFlags
+
+## 1.3.x development series
+
+### Changes with 1.3.0
+
+*A new series was started due to the major changes required for 'set -e' support.*
+
+Upgraded shUnit2 to 2.1.9pre, which includes 'set -e' support.
+
+Fixed #9. shFlags now works properly with 'set -e' enabled.
+
+Fixed #50. The `FLAGS_ARGC` variable is no longer is no longer exported. The variable was marked obsolete in 1.0.3, and it is finally being removed.
+
+---
+
+## 1.2.x stable series
+
+### Changes with 1.2.3
+
+Upgraded shUnit2 to 2.1.7.
+
+Fixed the examples to work again with the new code structure.
+
+Removed `gen_test_report.sh` as it isn't used anymore.
+
+Minor fix for `_flags_underscoreName()` to insure POSIX compliance.
+
+Cleanup of pre-GitHub cruft.
+
+Fixed bug in `_flags_columns()` where `stty size` sometimes gave unexpected
+output, causing the function to not work.
+
+Replaced `test_runner` with upstream from https://github.com/kward/shlib.
+
+### Changes with 1.2.2
+
+Ran all scripts through [ShellCheck](http://www.shellcheck.net/).
+
+Replaced `shflags_test.sh` with `test_runner` from https://github.com/kward/shlib.
+
+Fixed issue #45. Empty help string causes `shflags_test_issue_28.sh` to fail.
+
+Continuous integration testing setup with [Travis CI](https://travis-ci.org/kward/shflags).
+
+Restructured code to be more GitHub like.
+
+### Changes with 1.2.1
+
+Fixed issue #43. Added support for BusyBox `ash` shell.
+
+Fixed issues #26, #27. Re-factored `_flags_itemInList()` to use built-ins.
+
+Fixed issue #31. Documented newline support in `FLAGS_HELP`.
+
+Fixed issue #28. `DEFINE_boolean` misbehaves when help-string is empty.
+
+Fixed issue #25. Fix some typos.
+
+### Changes with 1.2.0
+
+Changed from the LGPL v2.1 license to the Apache v2.0 license so that others can include the library or make changes without needing to release the modified source code as well.
+
+Moved documentation to Markdown.
+
+Migrated the code to GitHub as http://code.google.com/ is turning down.
+
+Fixed issue #10. Usage of `expr` under FreeBSD 7.2 (FreeNAS 0.7.1) and FreeBSD 8.0 that was causing many unit tests to fail.
+
+Fixed issue where booleans were sometimes mis-configured to require additional values like other flags.
+
+Changed `_flags_fatal()` to exit with `FLAGS_ERROR` immediately.
+
+Fixed issue #11. When help is requested, the help flag is no longer prefixed with '[no]'.
+
+Upgraded shUnit2 to 2.1.6.
+
+Fixed issue #12. Requesting help shouldn't be considered an error.
+
+Added the ability to override the use of the OS default `getopt` command by defining the `FLAGS_GETOPT_CMD` variable.
+
+Updated `gen_test_results.sh` and versions from shUnit2 source.
+
+Fixed issues #13, #14. Added support for dashes '-' in long flag names. The defined flag will still be declared with underscores '\_' due to shell limitations, so only one of a dashed flag name or an underscored flag name are allowed, not both. (Backslash on _ to prevent Markdown formatting.)
+
+Issue #20. Updated LGPL v2.1 license from http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
+
+Issue #15. Use `gexpr` instead of `expr` on BSD variants.
+
+Minor tweaks to make run on FreeBSD 9.1.
+
+Fixed issue in `shflags_test_public.sh` where screens >80 columns were causing a test to fail.
+
+Issue #22. Fixed broken `testGetFlagInfo()` test.
+
+Created alternate `validFloat()` and `validInt()` functions that use shell built-ins where possible to increase performance and reduce the usage of the `expr` command.
+
+Added separate built-in and `expr` functions for doing math.
+
+---
+
+## 1.0.x stable series
+
+### Changes with 1.0.3
+
+MAJOR CHANGE! `FLAGS_ARGC` is now obsolete, and is replaced by `FLAGS_ARGV`. See below for more info.
+
+Fixed issue# 7 where long flags defined with '=' (e.g. `--abc=123`) made it impossible for the user to know how many non-flag command-line arguments were available because the value returned by `FLAGS_ARGC` was wrong. The `FLAGS_ARGC` value is now obsolete, but will be maintained for backwards compatibility. The new method of getting the non-flag arguments is by executing `eval set -- "${FLAGS_ARGV}"` after the `FLAGS` call. The arguments will then be available using the standard shell $#, $@, $\*, $1, etc. variables. (Backslash on \* to prevent Markdown formatting.)
+
+Due to above fix for issue# 7, there is now proper support for mixing flags with non-flag arguments on the command-line. Previously, all non-flag arguments had to be at the end of the command-line.
+
+Renamed `_flags_standardGetopt()` and `_flags_enhancedGetopt()` functions to `_flags_getoptStandard()` and `_flags_getoptEnhanced()`.
+
+Took out the setting and restoration of the '-u' shell flag to treat unset variables as an error. No point in having it in this library as it is verified in the unit tests, and provides basically no benefit.
+
+Fixed bug under Solaris where the generated help was adding extra 'x' characters.
+
+Added checks for reserved flag variables (e.g. `FLAGS_TRUE`).
+
+Fixed some unset variable bugs.
+
+Now report the actual `getopt` error if there is one.
+
+All tests now properly enable skipping based on whether a standard or enhanced `getopt` is found.
+
+Added the OS version to OS release for Solaris.
+
+Fixed `flags_reset()` so it unsets the default value environment vars.
+
+### Changes with 1.0.2
+
+`${FLAGS_PARENT}` no longer transforms into a constant so that it can be defined at run time in scripts.
+
+Added warning about short flags being unsupported when there are problems
+parsing the options with `getopt`.
+
+Add default values to end of description strings.
+
+Fixed bug that returned an error instead of success when recalling the default values for empty strings.
+
+Added warning when a duplicate flag definition is attempted.
+
+Improved `assert[Warn|Error]Msg()` test helper grepping.
+
+Replaced shell_versions.sh with a new versions library and created `gen_test_results.sh` to make releases easier.
+
+Copied the coding standards from shUnit2, but haven't fully implemented them in shFlags yet.
+
+Issue# 1: When a user defines their own `--help` flag, no more warning is thrown when `FLAGS()` is called stating that the help flag already defined.
+
+Issue# 2: Passing the `--nohelp` option no longer gives help output.
+
+Issue# 3: Added support for screen width detection.
+
+### Changes with 1.0.1
+
+Fixed bug where the help output added '[no]' to all flag names
+
+Added additional example files that are referenced by the documentation.
+
+Improved `zsh` version and option checking.
+
+Upgraded shUnit2 to 2.1.4
+
+Added unit testing for the help output.
+
+When including a library (e.g. shflags) in a script, zsh 3.0.8 doesn't actually execute the code in-line, but later. As such, variables that are defined in the library cannot be used until functions are called from the main code. This required the 'help' flag definition to be moved inside the `FLAGS` command.
+
+### Changes with 1.0.0
+
+This is the first official release, so everything is new.
diff --git a/doc/RELEASE_NOTES-1.2.0.md b/doc/RELEASE_NOTES-1.2.0.md
index bf76941..09cb69d 100644
--- a/doc/RELEASE_NOTES-1.2.0.md
+++ b/doc/RELEASE_NOTES-1.2.0.md
@@ -12,7 +12,7 @@ Release info
This is a minor bug fix release.
-Please see the `CHANGES-1.0.txt` file for a complete list of changes.
+Please see the `CHANGES-1.2.md` file for a complete list of changes.
Major changes
-------------
diff --git a/doc/RELEASE_NOTES-1.2.1.md b/doc/RELEASE_NOTES-1.2.1.md
new file mode 100644
index 0000000..789768e
--- /dev/null
+++ b/doc/RELEASE_NOTES-1.2.1.md
@@ -0,0 +1,66 @@
+# shFlags 1.2.1 Release Notes
+
+https://github.com/kward/shflags
+
+## Preface
+
+This document covers any known issues and workarounds for the stated release of
+shFlags.
+
+
+## Release info
+
+This is a minor bug fix release.
+
+Please see the `CHANGES-1.2.md` file for a complete list of changes.
+
+### Notable changes
+
+Support for the BusyBox `ash` shell was added.
+
+### Notable bug fixes
+
+Fixed issue #28. DEFINE_boolean misbehaves when help-string is empty.
+
+
+## General info
+
+### The unit tests
+
+shFlags is designed to work on as many environments as possible, but not all
+environments are created equal. As such, not all of the unit tests will succeed
+on every platform. The unit tests are therefore designed to fail, indicating to
+the tester that the supported functionality is not present, but an additional
+test is present to verify that shFlags properly caught the limitation and
+presented the user with an appropriate error message.
+
+shFlags tries to support both the standard and enhanced versions of `getopt`.
+As each responds differently, and not everything is supported on the standard
+version, some unit tests will be skipped (i.e. ASSERTS will not be thrown) when
+the standard version of `getopt` is detected. The reason being that there is
+no point testing for functionality that is positively known not to exist. A
+tally of skipped tests will be kept for later reference.
+
+### Standard vs Enhanced getopt
+
+Here is a matrix of the supported features of the various `getopt` variants.
+
+| Feature | std | enh |
+|-----------------------------------------|-----|-----|
+| short option names | Y | Y |
+| long option names | N | Y |
+| spaces in string options | N | Y |
+| intermixing of flag and non-flag values | N | Y |
+
+
+## Known Issues
+
+The `getopt` version provided by default with all versions of Mac OS X (up to
+and including 10.10.2) and Solaris (up to and including Solaris 10 and
+OpenSolaris) is the standard version.
+
+## Workarounds
+
+The Zsh shell requires the `shwordsplit` option to be set and the special
+`FLAGS_PARENT` variable must be defined. See `src/shflags_test_helpers` to
+see how the unit tests do this.
diff --git a/doc/RELEASE_NOTES-1.2.2.md b/doc/RELEASE_NOTES-1.2.2.md
new file mode 100644
index 0000000..7e09fda
--- /dev/null
+++ b/doc/RELEASE_NOTES-1.2.2.md
@@ -0,0 +1,72 @@
+# shFlags 1.2.2 Release Notes
+
+https://github.com/kward/shflags
+
+## Preface
+
+This document covers any known issues and workarounds for the stated release of
+shFlags.
+
+## Release info
+
+This is a minor bug fix release.
+
+Please see the `CHANGES-1.2.md` file for a complete list of changes.
+
+### Notable changes
+
+Continuous integration testing setup with [Travis CI][travis-ci]. This helps
+keep the code in a working state by executing the unit tests on every submit.
+
+[travis-ci]: https://travis-ci.org/kward/shflags
+
+All code run through [ShellCheck](http://www.shellcheck.net/). This is an
+excellent shell linter, and brings consistency to the coding patterns used.
+
+The code was restructured to be more GitHub friendly. It should make the code
+more appealing to a wider audience.
+
+### Notable bug fixes
+
+Fixed issue #45. Empty help string causes `shflags_test_issue_28.sh` to fail.
+
+## General info
+
+### The unit tests
+
+shFlags is designed to work on as many environments as possible, but not all
+environments are created equal. As such, not all of the unit tests will succeed
+on every platform. The unit tests are therefore designed to fail, indicating to
+the tester that the supported functionality is not present, but an additional
+test is present to verify that shFlags properly caught the limitation and
+presented the user with an appropriate error message.
+
+shFlags tries to support both the standard and enhanced versions of `getopt`. As
+each responds differently, and not everything is supported on the standard
+version, some unit tests will be skipped (i.e. ASSERTS will not be thrown) when
+the standard version of `getopt` is detected. The reason being that there is no
+point testing for functionality that is positively known not to exist. A tally
+of skipped tests will be kept for later reference.
+
+### Standard vs Enhanced getopt
+
+Here is a matrix of the supported features of the various `getopt` variants.
+
+Feature | std | enh
+--------------------------------------- | --- | ---
+short option names | Y | Y
+long option names | N | Y
+spaces in string options | N | Y
+intermixing of flag and non-flag values | N | Y
+
+## Known Issues
+
+The `getopt` version provided by default with all versions of Mac OS X (up to
+and including 10.13.0) and Solaris (up to and including Solaris 10 and
+OpenSolaris) is the standard version.
+
+## Workarounds
+
+The Zsh shell requires the `shwordsplit` option to be set and the special
+`FLAGS_PARENT` variable must be defined. See `src/shflags_test_helpers` to see
+how the unit tests do this.
diff --git a/doc/RELEASE_NOTES-1.2.3.md b/doc/RELEASE_NOTES-1.2.3.md
new file mode 100644
index 0000000..2764721
--- /dev/null
+++ b/doc/RELEASE_NOTES-1.2.3.md
@@ -0,0 +1,67 @@
+# shFlags 1.2.3 Release Notes
+
+https://github.com/kward/shflags
+
+## Preface
+
+This document covers any known issues and workarounds for the stated release of
+shFlags.
+
+## Release info
+
+This is a minor bug fix and cleanup release.
+
+There were several minor changes thanks to feedback from a major code review by
+[James Youngman](https://www.linkedin.com/in/jamesyoungman/). Thank you!
+
+Please see the `CHANGES-1.2.md` file for a complete list of changes.
+
+### Notable changes
+
+None.
+
+### Notable bug fixes
+
+Fixed the examples to work again with the new code structure. These broke when
+the code was refactored for GitHub.
+
+## General info
+
+### The unit tests
+
+shFlags is designed to work on as many environments as possible, but not all
+environments are created equal. As such, not all of the unit tests will succeed
+on every platform. The unit tests are therefore designed to fail, indicating to
+the tester that the supported functionality is not present, but an additional
+test is present to verify that shFlags properly caught the limitation and
+presented the user with an appropriate error message.
+
+shFlags tries to support both the standard and enhanced versions of `getopt`. As
+each responds differently, and not everything is supported on the standard
+version, some unit tests will be skipped (i.e. ASSERTS will not be thrown) when
+the standard version of `getopt` is detected. The reason being that there is no
+point testing for functionality that is positively known not to exist. A tally
+of skipped tests will be kept for later reference.
+
+### Standard vs Enhanced getopt
+
+Here is a matrix of the supported features of the various `getopt` variants.
+
+Feature | std | enh
+--------------------------------------- | --- | ---
+short option names | Y | Y
+long option names | N | Y
+spaces in string options | N | Y
+intermixing of flag and non-flag values | N | Y
+
+## Known Issues
+
+The `getopt` version provided by default with all versions of Mac OS X (up to
+and including 10.13.0) and Solaris (up to and including Solaris 10 and
+OpenSolaris) is the standard version.
+
+## Workarounds
+
+The Zsh shell requires the `shwordsplit` option to be set and the special
+`FLAGS_PARENT` variable must be defined. See `src/shflags_test_helpers` to see
+how the unit tests do this.
diff --git a/doc/coding_standards.txt b/doc/coding_standards.txt
deleted file mode 100644
index 1a9b52e..0000000
--- a/doc/coding_standards.txt
+++ /dev/null
@@ -1,118 +0,0 @@
-Coding Standards
-================
-
-shFlags is more than just a simple 20 line shell script. It is a pretty
-significant library of shell code that at first glance is not that easy to
-understand. To improve code readability and usability, some guidelines have
-been set down to make the code more understandable for anyone who wants to read
-or modify it.
-
-Function Documentation
-----------------------
-
-Each function should be preceded by a header that provides the following:
-
-#. A one-sentence summary of what the function does
-#. (optional) A longer description of what the function does, and perhaps some
- special information that helps convey its usage better.
-#. Args: a one-line summary of each argument of the form:
- ``name: type: description``
-#. Output: a one-line summary of the output provided. Only output to STDOUT
- must be documented, unless the output to STDERR is of significance (i.e. not
- just an error message). The output should be of the form:
- ``type: description``
-#. Returns: a one-line summary of the value returned. Returns in shell are
- always integers, but if the output is a true/false for success (i.e. a
- boolean), it should be noted. The output should be of the form:
- ``type: description``
-
-Here is a sample header: ::
-
- # Return valid getopt options using currently defined list of long options.
- #
- # This function builds a proper getopt option string for short (and long)
- # options, using the current list of long options for reference.
- #
- # Args:
- # _flags_optStr: integer: option string type (__FLAGS_OPTSTR_*)
- # Output:
- # string: generated option string for getopt
- # Returns:
- # boolean: success of operation (always returns True)
-
-Variable and Function Names
----------------------------
-
-All shFlags specific constants, variables, and functions will be prefixed
-appropriately with 'flags'. This is to distinguish usage in the shFlags code
-from users own scripts so that the shell name space remains predictable to
-users. The exceptions here are the standard ``assertEquals``, etc. functions.
-
-All non built-in constants and variables will be surrouned with squiggle
-brackets, e.g. '${flags_someVariable}' to improve code readability.
-
-Due to some shells not supporting local variables in functions, care in the
-naming and use of variables, both public and private, is very important.
-Accidental overriding of the variables can occur easily if care is not taken as
-all variables are technically global variables in some shells.
-
-================================ ========================
-**type** **sample**
-global public constant ``FLAGS_TRUE``
-global private constant ``__FLAGS_SHELL_FLAGS``
-global public variable ``flags_variable``
-global private variable ``__flags_variable``
-global macro ``_FLAGS_SOME_MACRO_``
-public function ``flags_function``
-public function, local variable ``flags_variable_``
-private function ``_flags_function``
-private function, local variable ``_flags_variable_``
-================================ ========================
-
-Where it makes sense to improve readability, variables can have the first
-letter of the second and later words capitalized. For example, the local
-variable name for the help string length is ``flags_helpStrLen_``.
-
-There are three special-case global public variables used. They are used due to
-overcome the limitations of shell scoping or to prevent forking. The three variables are:
-
- - flags_error
- - flags_output
- - flags_return
-
-Local Variable Cleanup
-----------------------
-
-As many shells do not support local variables, no support for cleanup of
-variables is present either. As such, all variables local to a function must be
-cleared up with the ``unset`` command at the end of each function.
-
-Indentation
------------
-
-Code block indentation is two (2) spaces, and tabs may not be used. ::
-
- if [ -z 'some string' ]; then
- someFunction
- fi
-
-Lines of code should be no longer than 80 characters unless absolutely
-necessary. When lines are wrapped using the backslash character '\', subsequent
-lines should be indented with four (4) spaces so as to differentiate from the
-standard spacing of two characters, and tabs may not be used. ::
-
- for x in some set of very long set of arguments that make for a very long \
- that extends much too long for one line
- do
- echo ${x}
- done
-
-When a conditional expression is written using the builtin [ command, and that
-line must be wrapped, place the control || or && operators on the same line as
-the expression where possible, with the list to be executed on its own line. ::
-
- [ -n 'some really long expression' -a -n 'some other long expr' ] && \
- echo 'that was actually true!'
-
-.. vim:spell
-.. $Id$
diff --git a/doc/contributors.txt b/doc/contributors.txt
deleted file mode 100644
index 2c3c824..0000000
--- a/doc/contributors.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-I'd like to thank these people for their contributisons to shFlags.
-
-Maciej Bliziński <blizinski@google.com>
-Bjarni Einarsson <bre@google.com>
-pvanderdoes [http://code.google.com/u/103206786526099082032/]
diff --git a/doc/rst2html.css b/doc/rst2html.css
deleted file mode 100644
index 01983a5..0000000
--- a/doc/rst2html.css
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
-:Author: David Goodger
-:Contact: goodger@users.sourceforge.net
-:Date: $Date: 2007-04-11 11:48:16 +0100 (Wed, 11 Apr 2007) $
-:Revision: $Revision: 2791 $
-:Copyright: This stylesheet has been placed in the public domain.
-:Modified by: Kate Ward <kate.ward@forestent.com>
-
-Default cascading style sheet for the HTML output of Docutils.
-
-See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
-customize this style sheet.
-*/
-
-/* used to remove borders from tables and images */
-.borderless, table.borderless td, table.borderless th {
- border: 0 }
-
-table.borderless td, table.borderless th {
- /* Override padding for "table.docutils td" with "! important".
- The right padding separates the table cells. */
- padding: 0 0.5em 0 0 ! important }
-
-.first {
- /* Override more specific margin styles with "! important". */
- margin-top: 0 ! important }
-
-.last, .with-subtitle {
- margin-bottom: 0 ! important }
-
-.hidden {
- display: none }
-
-a.toc-backref {
- text-decoration: none ;
- color: black }
-
-blockquote.epigraph {
- margin: 2em 5em ; }
-
-dl.docutils dd {
- margin-bottom: 0.5em }
-
-/* Uncomment (and remove this text!) to get bold-faced definition list terms
-dl.docutils dt {
- font-weight: bold }
-*/
-
-div.abstract {
- margin: 2em 5em }
-
-div.abstract p.topic-title {
- font-weight: bold ;
- text-align: center }
-
-div.admonition, div.attention, div.caution, div.danger, div.error,
-div.hint, div.important, div.note, div.tip, div.warning {
- margin: 2em ;
- border: medium outset ;
- padding: 1em }
-
-div.admonition p.admonition-title, div.hint p.admonition-title,
-div.important p.admonition-title, div.note p.admonition-title,
-div.tip p.admonition-title {
- font-weight: bold ;
- font-family: sans-serif }
-
-div.attention p.admonition-title, div.caution p.admonition-title,
-div.danger p.admonition-title, div.error p.admonition-title,
-div.warning p.admonition-title {
- color: red ;
- font-weight: bold ;
- font-family: sans-serif }
-
-/* Uncomment (and remove this text!) to get reduced vertical space in
- compound paragraphs.
-div.compound .compound-first, div.compound .compound-middle {
- margin-bottom: 0.5em }
-
-div.compound .compound-last, div.compound .compound-middle {
- margin-top: 0.5em }
-*/
-
-div.dedication {
- margin: 2em 5em ;
- text-align: center ;
- font-style: italic }
-
-div.dedication p.topic-title {
- font-weight: bold ;
- font-style: normal }
-
-div.figure {
- margin-left: 2em ;
- margin-right: 2em }
-
-div.footer, div.header {
- clear: both;
- font-size: smaller }
-
-div.line-block {
- display: block ;
- margin-top: 1em ;
- margin-bottom: 1em }
-
-div.line-block div.line-block {
- margin-top: 0 ;
- margin-bottom: 0 ;
- margin-left: 1.5em }
-
-div.sidebar {
- margin-left: 1em ;
- border: medium outset ;
- padding: 1em ;
- background-color: #ffffee ;
- width: 40% ;
- float: right ;
- clear: right }
-
-div.sidebar p.rubric {
- font-family: sans-serif ;
- font-size: medium }
-
-div.system-messages {
- margin: 5em }
-
-div.system-messages h1 {
- color: red }
-
-div.system-message {
- border: medium outset ;
- padding: 1em }
-
-div.system-message p.system-message-title {
- color: red ;
- font-weight: bold }
-
-div.topic {
- margin: 2em }
-
-h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
-h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
- margin-top: 0.4em }
-
-h1.title {
- text-align: center }
-
-h2.subtitle {
- text-align: center }
-
-hr.docutils {
- width: 75% }
-
-img.align-left {
- clear: left }
-
-img.align-right {
- clear: right }
-
-ol.simple, ul.simple {
- margin-bottom: 1em }
-
-ol.arabic {
- list-style: decimal }
-
-ol.loweralpha {
- list-style: lower-alpha }
-
-ol.upperalpha {
- list-style: upper-alpha }
-
-ol.lowerroman {
- list-style: lower-roman }
-
-ol.upperroman {
- list-style: upper-roman }
-
-p.attribution {
- text-align: right ;
- margin-left: 50% }
-
-p.caption {
- font-style: italic }
-
-p.credits {
- font-style: italic ;
- font-size: smaller }
-
-p.label {
- white-space: nowrap }
-
-p.rubric {
- font-weight: bold ;
- font-size: larger ;
- color: maroon ;
- text-align: center }
-
-p.sidebar-title {
- font-family: sans-serif ;
- font-weight: bold ;
- font-size: larger }
-
-p.sidebar-subtitle {
- font-family: sans-serif ;
- font-weight: bold }
-
-p.topic-title {
- font-weight: bold }
-
-pre.address {
- margin-bottom: 0 ;
- margin-top: 0 ;
- font-family: serif ;
- font-size: 100% }
-
-pre.literal-block, pre.doctest-block {
- margin-left: 2em ;
- margin-right: 2em ;
- background-color: #eeeeee }
-
-span.classifier {
- font-family: sans-serif ;
- font-style: oblique }
-
-span.classifier-delimiter {
- font-family: sans-serif ;
- font-weight: bold }
-
-span.interpreted {
- font-family: sans-serif }
-
-span.option {
- white-space: nowrap }
-
-span.pre {
- white-space: pre }
-
-span.problematic {
- color: red }
-
-span.section-subtitle {
- /* font-size relative to parent (h1..h6 element) */
- font-size: 80% }
-
-table.citation {
- border-left: solid 1px gray;
- margin-left: 1px }
-
-table.docinfo {
- margin: 2em 4em }
-
-/*
-table.docutils {
- margin-top: 0.5em ;
- margin-bottom: 0.5em }
-*/
-
-table.footnote {
- border-left: solid 1px black;
- margin-left: 1px ;
- font-size: 80% }
- }
-
-table.docutils td, table.docutils th,
-table.docinfo td, table.docinfo th {
- padding-left: 0.5em ;
- padding-right: 0.5em ;
- vertical-align: top }
-
-table.docutils th.field-name, table.docinfo th.docinfo-name {
- font-weight: bold ;
- text-align: left ;
- white-space: nowrap ;
- padding-left: 0 }
-
-h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
-h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
- font-size: 100% }
-
-/*
-tt.docutils {
- background-color: #eeeeee }
-*/
-
-ul.auto-toc {
- list-style-type: none }
-
-/* customizations by kward */
-
-h1 { font-size: 133%; border-top:1px solid #CCCCFF; }
-h1.title { font-size: 150%; border-top:0px; padding-top: 1em; }
-/* div.document { font-size: 90% } */
diff --git a/examples/debug_output.sh b/examples/debug_output.sh
index b3ecec2..a5e61c8 100755
--- a/examples/debug_output.sh
+++ b/examples/debug_output.sh
@@ -11,10 +11,10 @@
# $ ./debug_output.sh sing
# $ ./debug_output.sh --debug sing
-# source shflags
-. ../src/shflags
+# Source shflags.
+. ../shflags
-# define flags
+# Define flags.
DEFINE_boolean 'debug' false 'enable debug mode' 'd'
FLAGS_HELP=`cat <<EOF
commands:
@@ -22,21 +22,17 @@ commands:
sing: sing something
EOF`
-
-debug()
-{
+debug() {
[ ${FLAGS_debug} -eq ${FLAGS_TRUE} ] || return
echo "DEBUG: $@" >&2
}
-die() {
- [ $# -gt 0 ] && echo "error: $@" >&2
+die() { [ $# -gt 0 ] && echo "error: $@" >&2
flags_help
exit 1
}
-
-# parse the command-line
+# Parse the command-line.
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
diff --git a/examples/hello_world.sh b/examples/hello_world.sh
index 84b755a..e5fe81c 100755
--- a/examples/hello_world.sh
+++ b/examples/hello_world.sh
@@ -7,13 +7,13 @@
# '--name'). If a name is given, it is output, otherwise the default of 'world'
# is output.
-# source shflags
-. ../src/shflags
+# Source shflags.
+. ../shflags
-# define a 'name' command-line string flag
+# Define a 'name' command-line string flag.
DEFINE_string 'name' 'world' 'name to say hello to' 'n'
-# parse the command-line
+# Parse the command-line.
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
diff --git a/examples/write_date.sh b/examples/write_date.sh
index b8e610b..d9ae3ec 100755
--- a/examples/write_date.sh
+++ b/examples/write_date.sh
@@ -20,35 +20,44 @@
# $ ./write_date.sh -f now.out
# $ cat now.out
-# source shflags
-. ../src/shflags
+# Source shFlags.
+. ../shflags
-# configure shflags
+# Configure shFlags.
DEFINE_boolean 'force' false 'force overwriting' 'f'
FLAGS_HELP="USAGE: $0 [flags] filename"
-
-write_date()
-{
- date >"$1"
-}
-
-die()
-{
- [ $# -gt 0 ] && echo "error: $@" >&2
+die() {
+ [ $# -gt 0 ] && echo "error: $@"
flags_help
exit 1
}
-
-# parse the command-line
+# Parse the command-line.
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
-# check for filename
-[ $# -gt 0 ] || die 'filename missing'
+# Check for filename on command-line.
+[ $# -gt 0 ] || die 'filename missing.'
filename=$1
-[ -f "${filename}" -a ${FLAGS_force} -eq ${FLAGS_FALSE} ] \
- && die 'filename exists; not overwriting'
-write_date "${filename}"
+# Redirect STDOUT to the file ($1). This seemingly complicated method using exec
+# is used so that a potential race condition between checking for the presence
+# of the file and writing to the file is mitigated.
+if [ ${FLAGS_force} -eq ${FLAGS_FALSE} ] ; then
+ [ ! -f "${filename}" ] || die "file \"${filename}\" already exists."
+ # Set noclobber, redirect STDOUT to the file, first saving STDOUT to fd 4.
+ set -C
+ exec 4>&1 >"${filename}" # This fails if the file exists.
+else
+ # Forcefully overwrite (clobber) the file.
+ exec 4>&1 >|"${filename}"
+fi
+
+# What time is it?
+date
+
+# Restore STDOUT from file descriptor 4, and close fd 4.
+exec 1>&4 4>&-
+
+echo "The current date was written to \"${filename}\"."
diff --git a/init_githooks.sh b/init_githooks.sh
new file mode 100755
index 0000000..3349df4
--- /dev/null
+++ b/init_githooks.sh
@@ -0,0 +1,47 @@
+#! /bin/sh
+#
+# Initialize the local git hooks this repository.
+# https://git-scm.com/docs/githooks
+
+topLevel=$(git rev-parse --show-toplevel)
+if ! cd "${topLevel}"; then
+ echo "filed to cd into topLevel directory '${topLevel}'"
+ exit 1
+fi
+
+hooksDir="${topLevel}/.githooks"
+if ! hooksPath=$(git config core.hooksPath); then
+ hooksPath="${topLevel}/.git/hooks"
+fi
+
+src="${hooksDir}/generic"
+echo "linking hooks..."
+for hook in \
+ applypatch-msg \
+ pre-applypatch \
+ post-applypatch \
+ pre-commit \
+ pre-merge-commit \
+ prepare-commit-msg \
+ commit-msg \
+ post-commit \
+ pre-rebase \
+ post-checkout \
+ post-merge \
+ pre-push \
+ pre-receive \
+ update \
+ post-receive \
+ post-update \
+ push-to-checkout \
+ pre-auto-gc \
+ post-rewrite \
+ sendemail-validate \
+ fsmonitor-watchman \
+ p4-pre-submit \
+ post-index-change
+do
+ echo " ${hook}"
+ dest="${hooksPath}/${hook}"
+ ln -sf "${src}" "${dest}"
+done
diff --git a/lib/shlib b/lib/shlib
deleted file mode 100644
index 0bd151d..0000000
--- a/lib/shlib
+++ /dev/null
@@ -1,34 +0,0 @@
-# vim:et:ft=sh:sts=2:sw=2
-#
-# Library of shell functions.
-
-# Convert a relative path into it's absolute equivalent.
-#
-# This function will automatically prepend the current working directory if the
-# path is not already absolute. It then removes all parent references (../) to
-# reconstruct the proper absolute path.
-#
-# Args:
-# shlib_path_: string: relative path
-# Outputs:
-# string: absolute path
-shlib_relToAbsPath()
-{
- shlib_path_=$1
-
- # prepend current directory to relative paths
- echo "${shlib_path_}" |grep '^/' >/dev/null 2>&1 \
- || shlib_path_="`pwd`/${shlib_path_}"
-
- # clean up the path. if all seds supported true regular expressions, then
- # this is what it would be:
- shlib_old_=${shlib_path_}
- while true; do
- shlib_new_=`echo "${shlib_old_}" |sed 's/[^/]*\/\.\.\/*//g;s/\/\.\//\//'`
- [ "${shlib_old_}" = "${shlib_new_}" ] && break
- shlib_old_=${shlib_new_}
- done
- echo "${shlib_new_}"
-
- unset shlib_path_ shlib_old_ shlib_new_
-}
diff --git a/lib/shunit2 b/lib/shunit2
index 590a5a8..2850370 100644..100755
--- a/lib/shunit2
+++ b/lib/shunit2
@@ -1,95 +1,165 @@
#! /bin/sh
-# $Id: shunit2 322 2011-04-24 00:09:45Z kate.ward@forestent.com $
# vim:et:ft=sh:sts=2:sw=2
#
-# Copyright 2008 Kate Ward. All Rights Reserved.
-# Released under the LGPL (GNU Lesser General Public License)
+# Copyright 2008-2020 Kate Ward. All Rights Reserved.
+# Released under the Apache 2.0 license.
+# http://www.apache.org/licenses/LICENSE-2.0
#
# shUnit2 -- Unit testing framework for Unix shell scripts.
-# http://code.google.com/p/shunit2/
+# https://github.com/kward/shunit2
#
# Author: kate.ward@forestent.com (Kate Ward)
#
# shUnit2 is a xUnit based unit test framework for Bourne shell scripts. It is
# based on the popular JUnit unit testing framework for Java.
+#
+# $() are not fully portable (POSIX != portable).
+# shellcheck disable=SC2006
+# expr may be antiquated, but it is the only solution in some cases.
+# shellcheck disable=SC2003
-# return if shunit already loaded
-[ -n "${SHUNIT_VERSION:-}" ] && exit 0
-
-SHUNIT_VERSION='2.1.6'
+# Return if shunit2 already loaded.
+if test -n "${SHUNIT_VERSION:-}"; then
+ exit 0
+fi
+SHUNIT_VERSION='2.1.9pre'
+# Return values that scripts can use.
SHUNIT_TRUE=0
SHUNIT_FALSE=1
SHUNIT_ERROR=2
-# enable strict mode by default
-SHUNIT_STRICT=${SHUNIT_STRICT:-${SHUNIT_TRUE}}
+# Determine if `builtin` command exists.
+__SHUNIT_BUILTIN='builtin'
+# shellcheck disable=2039
+if ! ("${__SHUNIT_BUILTIN}" echo 123 >/dev/null 2>&1); then
+ __SHUNIT_BUILTIN=''
+fi
+
+# Determine some reasonable command defaults.
+__SHUNIT_CMD_ECHO_ESC='echo -e'
+# shellcheck disable=SC2039
+if ${__SHUNIT_BUILTIN} [ "`echo -e test`" = '-e test' ]; then
+ __SHUNIT_CMD_ECHO_ESC='echo'
+fi
+
+__SHUNIT_UNAME_S=`uname -s`
+case "${__SHUNIT_UNAME_S}" in
+ BSD) __SHUNIT_CMD_EXPR='gexpr' ;;
+ *) __SHUNIT_CMD_EXPR='expr' ;;
+esac
+__SHUNIT_CMD_TPUT='tput'
+
+# Commands a user can override if needed.
+SHUNIT_CMD_EXPR=${SHUNIT_CMD_EXPR:-${__SHUNIT_CMD_EXPR}}
+SHUNIT_CMD_TPUT=${SHUNIT_CMD_TPUT:-${__SHUNIT_CMD_TPUT}}
+
+# Enable color output. Options are 'never', 'always', or 'auto'.
+SHUNIT_COLOR=${SHUNIT_COLOR:-auto}
-_shunit_warn() { echo "shunit2:WARN $@" >&2; }
-_shunit_error() { echo "shunit2:ERROR $@" >&2; }
-_shunit_fatal() { echo "shunit2:FATAL $@" >&2; exit ${SHUNIT_ERROR}; }
+# Logging functions.
+_shunit_warn() {
+ ${__SHUNIT_CMD_ECHO_ESC} "${__shunit_ansi_yellow}shunit2:WARN${__shunit_ansi_none} $*" >&2
+}
+_shunit_error() {
+ ${__SHUNIT_CMD_ECHO_ESC} "${__shunit_ansi_red}shunit2:ERROR${__shunit_ansi_none} $*" >&2
+}
+_shunit_fatal() {
+ ${__SHUNIT_CMD_ECHO_ESC} "${__shunit_ansi_red}shunit2:FATAL${__shunit_ansi_none} $*" >&2
+ exit ${SHUNIT_ERROR}
+}
-# specific shell checks
-if [ -n "${ZSH_VERSION:-}" ]; then
+# Specific shell checks.
+if ${__SHUNIT_BUILTIN} [ -n "${ZSH_VERSION:-}" ]; then
setopt |grep "^shwordsplit$" >/dev/null
- if [ $? -ne ${SHUNIT_TRUE} ]; then
+ if ${__SHUNIT_BUILTIN} [ $? -ne ${SHUNIT_TRUE} ]; then
_shunit_fatal 'zsh shwordsplit option is required for proper operation'
fi
- if [ -z "${SHUNIT_PARENT:-}" ]; then
+ if ${__SHUNIT_BUILTIN} [ -z "${SHUNIT_PARENT:-}" ]; then
_shunit_fatal "zsh does not pass \$0 through properly. please declare \
\"SHUNIT_PARENT=\$0\" before calling shUnit2"
fi
fi
#
-# constants
+# Constants
#
-__SHUNIT_ASSERT_MSG_PREFIX='ASSERT:'
__SHUNIT_MODE_SOURCED='sourced'
__SHUNIT_MODE_STANDALONE='standalone'
__SHUNIT_PARENT=${SHUNIT_PARENT:-$0}
-# set the constants readonly
-shunit_constants_=`set |grep '^__SHUNIT_' |cut -d= -f1`
-echo "${shunit_constants_}" |grep '^Binary file' >/dev/null && \
- shunit_constants_=`set |grep -a '^__SHUNIT_' |cut -d= -f1`
-for shunit_constant_ in ${shunit_constants_}; do
- shunit_ro_opts_=''
- case ${ZSH_VERSION:-} in
- '') ;; # this isn't zsh
- [123].*) ;; # early versions (1.x, 2.x, 3.x)
- *) shunit_ro_opts_='-g' ;; # all later versions. declare readonly globally
- esac
- readonly ${shunit_ro_opts_} ${shunit_constant_}
+# User provided test prefix to display in front of the name of the test being
+# executed. Define by setting the SHUNIT_TEST_PREFIX variable.
+__SHUNIT_TEST_PREFIX=${SHUNIT_TEST_PREFIX:-}
+
+# ANSI colors.
+__SHUNIT_ANSI_NONE='\033[0m'
+__SHUNIT_ANSI_RED='\033[1;31m'
+__SHUNIT_ANSI_GREEN='\033[1;32m'
+__SHUNIT_ANSI_YELLOW='\033[1;33m'
+__SHUNIT_ANSI_CYAN='\033[1;36m'
+
+# Set the constants readonly.
+__shunit_constants=`set |grep '^__SHUNIT_' |cut -d= -f1`
+echo "${__shunit_constants}" |grep '^Binary file' >/dev/null && \
+ __shunit_constants=`set |grep -a '^__SHUNIT_' |cut -d= -f1`
+for __shunit_const in ${__shunit_constants}; do
+ if ${__SHUNIT_BUILTIN} [ -z "${ZSH_VERSION:-}" ]; then
+ readonly "${__shunit_const}"
+ else
+ case ${ZSH_VERSION} in
+ [123].*) readonly "${__shunit_const}" ;;
+ *)
+ # Declare readonly constants globally.
+ # shellcheck disable=SC2039
+ readonly -g "${__shunit_const}"
+ esac
+ fi
done
-unset shunit_constant_ shunit_constants_ shunit_ro_opts_
+unset __shunit_const __shunit_constants
+
+#
+# Internal variables.
+#
-# variables
-__shunit_lineno='' # line number of executed test
-__shunit_mode=${__SHUNIT_MODE_SOURCED} # operating mode
-__shunit_reportGenerated=${SHUNIT_FALSE} # is report generated
-__shunit_script='' # filename of unittest script (standalone mode)
-__shunit_skip=${SHUNIT_FALSE} # is skipping enabled
-__shunit_suite='' # suite of tests to execute
+# Variables.
+__shunit_lineno='' # Line number of executed test.
+__shunit_mode=${__SHUNIT_MODE_SOURCED} # Operating mode.
+__shunit_reportGenerated=${SHUNIT_FALSE} # Is report generated.
+__shunit_script='' # Filename of unittest script (standalone mode).
+__shunit_skip=${SHUNIT_FALSE} # Is skipping enabled.
+__shunit_suite='' # Suite of tests to execute.
+__shunit_clean=${SHUNIT_FALSE} # _shunit_cleanup() was already called.
-# counts of tests
+# ANSI colors (populated by _shunit_configureColor()).
+__shunit_ansi_none=''
+__shunit_ansi_red=''
+__shunit_ansi_green=''
+__shunit_ansi_yellow=''
+__shunit_ansi_cyan=''
+
+# Counts of tests.
__shunit_testSuccess=${SHUNIT_TRUE}
__shunit_testsTotal=0
__shunit_testsPassed=0
__shunit_testsFailed=0
-# counts of asserts
+# Counts of asserts.
__shunit_assertsTotal=0
__shunit_assertsPassed=0
__shunit_assertsFailed=0
__shunit_assertsSkipped=0
-# macros
-_SHUNIT_LINENO_='eval __shunit_lineno=""; if [ "${1:-}" = "--lineno" ]; then [ -n "$2" ] && __shunit_lineno="[$2] "; shift 2; fi'
+#
+# Macros.
+#
+
+# shellcheck disable=SC2016,SC2089
+_SHUNIT_LINENO_='eval __shunit_lineno=""; if ${__SHUNIT_BUILTIN} [ "${1:-}" = "--lineno" ]; then if ${__SHUNIT_BUILTIN} [ -n "$2" ]; then __shunit_lineno="[$2] "; fi; shift 2; fi'
#-----------------------------------------------------------------------------
-# assert functions
+# Assertion functions.
#
# Assert that two values are equal to one another.
@@ -100,18 +170,20 @@ _SHUNIT_LINENO_='eval __shunit_lineno=""; if [ "${1:-}" = "--lineno" ]; then [ -
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-assertEquals()
-{
+assertEquals() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 2 -o $# -gt 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
_shunit_error "assertEquals() requires two or three arguments; $# given"
- _shunit_error "1: ${1:+$1} 2: ${2:+$2} 3: ${3:+$3}"
+ _shunit_assertFail
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
@@ -119,7 +191,7 @@ assertEquals()
shunit_actual_=$2
shunit_return=${SHUNIT_TRUE}
- if [ "${shunit_expected_}" = "${shunit_actual_}" ]; then
+ if ${__SHUNIT_BUILTIN} [ "${shunit_expected_}" = "${shunit_actual_}" ]; then
_shunit_assertPass
else
failNotEquals "${shunit_message_}" "${shunit_expected_}" "${shunit_actual_}"
@@ -129,6 +201,7 @@ assertEquals()
unset shunit_message_ shunit_expected_ shunit_actual_
return ${shunit_return}
}
+# shellcheck disable=SC2016,SC2034
_ASSERT_EQUALS_='eval assertEquals --lineno "${LINENO:-}"'
# Assert that two values are not equal to one another.
@@ -139,17 +212,20 @@ _ASSERT_EQUALS_='eval assertEquals --lineno "${LINENO:-}"'
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-assertNotEquals()
-{
+assertNotEquals() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 2 -o $# -gt 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
_shunit_error "assertNotEquals() requires two or three arguments; $# given"
+ _shunit_assertFail
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
@@ -157,18 +233,102 @@ assertNotEquals()
shunit_actual_=$2
shunit_return=${SHUNIT_TRUE}
- if [ "${shunit_expected_}" != "${shunit_actual_}" ]; then
+ if ${__SHUNIT_BUILTIN} [ "${shunit_expected_}" != "${shunit_actual_}" ]; then
_shunit_assertPass
else
- failSame "${shunit_message_}" "$@"
+ failSame "${shunit_message_}" "${shunit_expected_}" "${shunit_actual_}"
shunit_return=${SHUNIT_FALSE}
fi
unset shunit_message_ shunit_expected_ shunit_actual_
return ${shunit_return}
}
+# shellcheck disable=SC2016,SC2034
_ASSERT_NOT_EQUALS_='eval assertNotEquals --lineno "${LINENO:-}"'
+# Assert that a container contains a content.
+#
+# Args:
+# message: string: failure message [optional]
+# container: string: container to analyze
+# content: string: content to find
+# Returns:
+# integer: success (TRUE/FALSE/ERROR constant)
+assertContains() {
+ # shellcheck disable=SC2090
+ ${_SHUNIT_LINENO_}
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
+ _shunit_error "assertContains() requires two or three arguments; $# given"
+ _shunit_assertFail
+ return ${SHUNIT_ERROR}
+ fi
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
+
+ shunit_message_=${__shunit_lineno}
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
+ shunit_message_="${shunit_message_}$1"
+ shift
+ fi
+ shunit_container_=$1
+ shunit_content_=$2
+ shunit_return=${SHUNIT_TRUE}
+ if echo "${shunit_container_}" |grep -F -- "${shunit_content_}" >/dev/null; then
+ _shunit_assertPass
+ else
+ failNotFound "${shunit_message_}" "${shunit_content_}"
+ shunit_return=${SHUNIT_FALSE}
+ fi
+
+ unset shunit_message_ shunit_container_ shunit_content_
+ return ${shunit_return}
+}
+# shellcheck disable=SC2016,SC2034
+_ASSERT_CONTAINS_='eval assertContains --lineno "${LINENO:-}"'
+
+# Assert that a container does not contain a content.
+#
+# Args:
+# message: string: failure message [optional]
+# container: string: container to analyze
+# content: string: content to look for
+# Returns:
+# integer: success (TRUE/FALSE/ERROR constant)
+assertNotContains() {
+ # shellcheck disable=SC2090
+ ${_SHUNIT_LINENO_}
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
+ _shunit_error "assertNotContains() requires two or three arguments; $# given"
+ _shunit_assertFail
+ return ${SHUNIT_ERROR}
+ fi
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
+
+ shunit_message_=${__shunit_lineno}
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
+ shunit_message_="${shunit_message_}$1"
+ shift
+ fi
+ shunit_container_=$1
+ shunit_content_=$2
+
+ shunit_return=${SHUNIT_TRUE}
+ if echo "$shunit_container_" | grep -F -- "$shunit_content_" > /dev/null; then
+ failFound "${shunit_message_}" "${shunit_content_}"
+ shunit_return=${SHUNIT_FALSE}
+ else
+ _shunit_assertPass
+ fi
+
+ unset shunit_message_ shunit_container_ shunit_content_
+ return ${shunit_return}
+}
+# shellcheck disable=SC2016,SC2034
+_ASSERT_NOT_CONTAINS_='eval assertNotContains --lineno "${LINENO:-}"'
+
# Assert that a value is null (i.e. an empty string)
#
# Args:
@@ -176,17 +336,20 @@ _ASSERT_NOT_EQUALS_='eval assertNotEquals --lineno "${LINENO:-}"'
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-assertNull()
-{
+assertNull() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 1 -o $# -gt 2 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -lt 1 -o $# -gt 2 ]; then
_shunit_error "assertNull() requires one or two arguments; $# given"
+ _shunit_assertFail
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 2 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 2 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
@@ -196,6 +359,7 @@ assertNull()
unset shunit_message_
return ${shunit_return}
}
+# shellcheck disable=SC2016,SC2034
_ASSERT_NULL_='eval assertNull --lineno "${LINENO:-}"'
# Assert that a value is not null (i.e. a non-empty string)
@@ -205,17 +369,21 @@ _ASSERT_NULL_='eval assertNull --lineno "${LINENO:-}"'
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-assertNotNull()
-{
+assertNotNull() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -gt 2 ]; then # allowing 0 arguments as $1 might actually be null
+ if ${__SHUNIT_BUILTIN} [ $# -gt 2 ]; then
+ # Allowing 0 arguments as $1 might actually be null.
_shunit_error "assertNotNull() requires one or two arguments; $# given"
+ _shunit_assertFail
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 2 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 2 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
@@ -227,6 +395,7 @@ assertNotNull()
unset shunit_actual_ shunit_message_
return ${shunit_return}
}
+# shellcheck disable=SC2016,SC2034
_ASSERT_NOT_NULL_='eval assertNotNull --lineno "${LINENO:-}"'
# Assert that two values are the same (i.e. equal to one another).
@@ -237,17 +406,20 @@ _ASSERT_NOT_NULL_='eval assertNotNull --lineno "${LINENO:-}"'
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-assertSame()
-{
+assertSame() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 2 -o $# -gt 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
_shunit_error "assertSame() requires two or three arguments; $# given"
+ _shunit_assertFail
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
@@ -257,6 +429,7 @@ assertSame()
unset shunit_message_
return ${shunit_return}
}
+# shellcheck disable=SC2016,SC2034
_ASSERT_SAME_='eval assertSame --lineno "${LINENO:-}"'
# Assert that two values are not the same (i.e. not equal to one another).
@@ -267,17 +440,20 @@ _ASSERT_SAME_='eval assertSame --lineno "${LINENO:-}"'
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-assertNotSame()
-{
+assertNotSame() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 2 -o $# -gt 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
_shunit_error "assertNotSame() requires two or three arguments; $# given"
+ _shunit_assertFail
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
shunit_message_="${shunit_message_:-}$1"
shift
fi
@@ -287,6 +463,7 @@ assertNotSame()
unset shunit_message_
return ${shunit_return}
}
+# shellcheck disable=SC2016,SC2034
_ASSERT_NOT_SAME_='eval assertNotSame --lineno "${LINENO:-}"'
# Assert that a value or shell test condition is true.
@@ -301,57 +478,63 @@ _ASSERT_NOT_SAME_='eval assertNotSame --lineno "${LINENO:-}"'
# The following test will succeed:
# assertTrue 0
# assertTrue "[ 34 -gt 23 ]"
-# The folloing test will fail with a message:
+# The following test will fail with a message:
# assertTrue 123
-# assertTrue "test failed" "[ -r '/non/existant/file' ]"
+# assertTrue "test failed" "[ -r '/non/existent/file' ]"
#
# Args:
# message: string: failure message [optional]
# condition: string: integer value or shell conditional statement
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-assertTrue()
-{
+assertTrue() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -gt 2 ]; then
- _shunit_error "assertTrue() takes one two arguments; $# given"
+ if ${__SHUNIT_BUILTIN} [ $# -lt 1 -o $# -gt 2 ]; then
+ _shunit_error "assertTrue() takes one or two arguments; $# given"
+ _shunit_assertFail
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 2 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 2 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
shunit_condition_=$1
- # see if condition is an integer, i.e. a return value
- shunit_match_=`expr "${shunit_condition_}" : '\([0-9]*\)'`
+ # See if condition is an integer, i.e. a return value.
shunit_return=${SHUNIT_TRUE}
- if [ -z "${shunit_condition_}" ]; then
- # null condition
+ if ${__SHUNIT_BUILTIN} [ -z "${shunit_condition_}" ]; then
+ # Null condition.
shunit_return=${SHUNIT_FALSE}
- elif [ -n "${shunit_match_}" -a "${shunit_condition_}" = "${shunit_match_}" ]
+ elif (expr \( "${shunit_condition_}" + '0' \) '=' "${shunit_condition_}" >/dev/null 2>&1)
then
- # possible return value. treating 0 as true, and non-zero as false.
- [ ${shunit_condition_} -ne 0 ] && shunit_return=${SHUNIT_FALSE}
+ # Possible return value. Treating 0 as true, and non-zero as false.
+ if ${__SHUNIT_BUILTIN} [ "${shunit_condition_}" -ne 0 ]; then
+ shunit_return=${SHUNIT_FALSE}
+ fi
else
- # (hopefully) a condition
- ( eval ${shunit_condition_} ) >/dev/null 2>&1
- [ $? -ne 0 ] && shunit_return=${SHUNIT_FALSE}
+ # Hopefully... a condition.
+ if ! eval "${shunit_condition_}" >/dev/null 2>&1; then
+ shunit_return=${SHUNIT_FALSE}
+ fi
fi
- # record the test
- if [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then
+ # Record the test.
+ if ${__SHUNIT_BUILTIN} [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then
_shunit_assertPass
else
_shunit_assertFail "${shunit_message_}"
fi
- unset shunit_message_ shunit_condition_ shunit_match_
+ unset shunit_message_ shunit_condition_
return ${shunit_return}
}
+# shellcheck disable=SC2016,SC2034
_ASSERT_TRUE_='eval assertTrue --lineno "${LINENO:-}"'
# Assert that a value or shell test condition is false.
@@ -366,7 +549,7 @@ _ASSERT_TRUE_='eval assertTrue --lineno "${LINENO:-}"'
# The following test will succeed:
# assertFalse 1
# assertFalse "[ 'apples' = 'oranges' ]"
-# The folloing test will fail with a message:
+# The following test will fail with a message:
# assertFalse 0
# assertFalse "test failed" "[ 1 -eq 1 -a 2 -eq 2 ]"
#
@@ -375,52 +558,58 @@ _ASSERT_TRUE_='eval assertTrue --lineno "${LINENO:-}"'
# condition: string: integer value or shell conditional statement
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-assertFalse()
-{
+assertFalse() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 1 -o $# -gt 2 ]; then
- _shunit_error "assertFalse() quires one or two arguments; $# given"
+ if ${__SHUNIT_BUILTIN} [ $# -lt 1 -o $# -gt 2 ]; then
+ _shunit_error "assertFalse() requires one or two arguments; $# given"
+ _shunit_assertFail
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 2 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 2 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
shunit_condition_=$1
- # see if condition is an integer, i.e. a return value
- shunit_match_=`expr "${shunit_condition_}" : '\([0-9]*\)'`
+ # See if condition is an integer, i.e. a return value.
shunit_return=${SHUNIT_TRUE}
- if [ -z "${shunit_condition_}" ]; then
- # null condition
- shunit_return=${SHUNIT_FALSE}
- elif [ -n "${shunit_match_}" -a "${shunit_condition_}" = "${shunit_match_}" ]
- then
- # possible return value. treating 0 as true, and non-zero as false.
- [ ${shunit_condition_} -eq 0 ] && shunit_return=${SHUNIT_FALSE}
+ if ${__SHUNIT_BUILTIN} [ -z "${shunit_condition_}" ]; then
+ # Null condition.
+ shunit_return=${SHUNIT_TRUE}
+ elif (expr \( "${shunit_condition_}" + '0' \) '=' "${shunit_condition_}" >/dev/null 2>&1); then
+ # Possible return value. Treating 0 as true, and non-zero as false.
+ if ${__SHUNIT_BUILTIN} [ "${shunit_condition_}" -eq 0 ]; then
+ shunit_return=${SHUNIT_FALSE}
+ fi
else
- # (hopefully) a condition
- ( eval ${shunit_condition_} ) >/dev/null 2>&1
- [ $? -eq 0 ] && shunit_return=${SHUNIT_FALSE}
+ # Hopefully... a condition.
+ # shellcheck disable=SC2086
+ if eval ${shunit_condition_} >/dev/null 2>&1; then
+ shunit_return=${SHUNIT_FALSE}
+ fi
fi
- # record the test
- if [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then
+ # Record the test.
+ if ${__SHUNIT_BUILTIN} [ "${shunit_return}" -eq "${SHUNIT_TRUE}" ]; then
_shunit_assertPass
else
_shunit_assertFail "${shunit_message_}"
fi
- unset shunit_message_ shunit_condition_ shunit_match_
- return ${shunit_return}
+ unset shunit_message_ shunit_condition_
+ return "${shunit_return}"
}
+# shellcheck disable=SC2016,SC2034
_ASSERT_FALSE_='eval assertFalse --lineno "${LINENO:-}"'
#-----------------------------------------------------------------------------
-# failure functions
+# Failure functions.
#
# Records a test failure.
@@ -429,17 +618,19 @@ _ASSERT_FALSE_='eval assertFalse --lineno "${LINENO:-}"'
# message: string: failure message [optional]
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-fail()
-{
+fail() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -gt 1 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -gt 1 ]; then
_shunit_error "fail() requires zero or one arguments; $# given"
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 1 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 1 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
@@ -449,6 +640,7 @@ fail()
unset shunit_message_
return ${SHUNIT_FALSE}
}
+# shellcheck disable=SC2016,SC2034
_FAIL_='eval fail --lineno "${LINENO:-}"'
# Records a test failure, stating two values were not equal.
@@ -459,30 +651,101 @@ _FAIL_='eval fail --lineno "${LINENO:-}"'
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-failNotEquals()
-{
+failNotEquals() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 2 -o $# -gt 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
_shunit_error "failNotEquals() requires one or two arguments; $# given"
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
shunit_expected_=$1
shunit_actual_=$2
+ shunit_message_=${shunit_message_%% }
_shunit_assertFail "${shunit_message_:+${shunit_message_} }expected:<${shunit_expected_}> but was:<${shunit_actual_}>"
unset shunit_message_ shunit_expected_ shunit_actual_
return ${SHUNIT_FALSE}
}
+# shellcheck disable=SC2016,SC2034
_FAIL_NOT_EQUALS_='eval failNotEquals --lineno "${LINENO:-}"'
+# Records a test failure, stating a value was found.
+#
+# Args:
+# message: string: failure message [optional]
+# content: string: found value
+# Returns:
+# integer: success (TRUE/FALSE/ERROR constant)
+failFound() {
+ # shellcheck disable=SC2090
+ ${_SHUNIT_LINENO_}
+ if ${__SHUNIT_BUILTIN} [ $# -lt 1 -o $# -gt 2 ]; then
+ _shunit_error "failFound() requires one or two arguments; $# given"
+ return ${SHUNIT_ERROR}
+ fi
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
+
+ shunit_message_=${__shunit_lineno}
+ if ${__SHUNIT_BUILTIN} [ $# -eq 2 ]; then
+ shunit_message_="${shunit_message_}$1"
+ shift
+ fi
+
+ shunit_message_=${shunit_message_%% }
+ _shunit_assertFail "${shunit_message_:+${shunit_message_} }found"
+
+ unset shunit_message_
+ return ${SHUNIT_FALSE}
+}
+# shellcheck disable=SC2016,SC2034
+_FAIL_FOUND_='eval failFound --lineno "${LINENO:-}"'
+
+# Records a test failure, stating a content was not found.
+#
+# Args:
+# message: string: failure message [optional]
+# content: string: content not found
+# Returns:
+# integer: success (TRUE/FALSE/ERROR constant)
+failNotFound() {
+ # shellcheck disable=SC2090
+ ${_SHUNIT_LINENO_}
+ if ${__SHUNIT_BUILTIN} [ $# -lt 1 -o $# -gt 2 ]; then
+ _shunit_error "failNotFound() requires one or two arguments; $# given"
+ return ${SHUNIT_ERROR}
+ fi
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
+
+ shunit_message_=${__shunit_lineno}
+ if ${__SHUNIT_BUILTIN} [ $# -eq 2 ]; then
+ shunit_message_="${shunit_message_}$1"
+ shift
+ fi
+ shunit_content_=$1
+
+ shunit_message_=${shunit_message_%% }
+ _shunit_assertFail "${shunit_message_:+${shunit_message_} }not found:<${shunit_content_}>"
+
+ unset shunit_message_ shunit_content_
+ return ${SHUNIT_FALSE}
+}
+# shellcheck disable=SC2016,SC2034
+_FAIL_NOT_FOUND_='eval failNotFound --lineno "${LINENO:-}"'
+
# Records a test failure, stating two values should have been the same.
#
# Args:
@@ -491,26 +754,30 @@ _FAIL_NOT_EQUALS_='eval failNotEquals --lineno "${LINENO:-}"'
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-failSame()
-{
+failSame() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 2 -o $# -gt 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
_shunit_error "failSame() requires two or three arguments; $# given"
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
+ shunit_message_=${shunit_message_%% }
_shunit_assertFail "${shunit_message_:+${shunit_message_} }expected not same"
unset shunit_message_
return ${SHUNIT_FALSE}
}
+# shellcheck disable=SC2016,SC2034
_FAIL_SAME_='eval failSame --lineno "${LINENO:-}"'
# Records a test failure, stating two values were not equal.
@@ -523,17 +790,19 @@ _FAIL_SAME_='eval failSame --lineno "${LINENO:-}"'
# actual: string: actual value
# Returns:
# integer: success (TRUE/FALSE/ERROR constant)
-failNotSame()
-{
+failNotSame() {
+ # shellcheck disable=SC2090
${_SHUNIT_LINENO_}
- if [ $# -lt 2 -o $# -gt 3 ]; then
- _shunit_error "failNotEquals() requires one or two arguments; $# given"
+ if ${__SHUNIT_BUILTIN} [ $# -lt 2 -o $# -gt 3 ]; then
+ _shunit_error "failNotSame() requires one or two arguments; $# given"
return ${SHUNIT_ERROR}
fi
- _shunit_shouldSkip && return ${SHUNIT_TRUE}
+ if _shunit_shouldSkip; then
+ return ${SHUNIT_TRUE}
+ fi
shunit_message_=${__shunit_lineno}
- if [ $# -eq 3 ]; then
+ if ${__SHUNIT_BUILTIN} [ $# -eq 3 ]; then
shunit_message_="${shunit_message_}$1"
shift
fi
@@ -543,10 +812,11 @@ failNotSame()
unset shunit_message_
return ${shunit_return}
}
+# shellcheck disable=SC2016,SC2034
_FAIL_NOT_SAME_='eval failNotSame --lineno "${LINENO:-}"'
#-----------------------------------------------------------------------------
-# skipping functions
+# Skipping functions.
#
# Force remaining assert and fail functions to be "skipped".
@@ -557,19 +827,13 @@ _FAIL_NOT_SAME_='eval failNotSame --lineno "${LINENO:-}"'
#
# Args:
# None
-startSkipping()
-{
- __shunit_skip=${SHUNIT_TRUE}
-}
+startSkipping() { __shunit_skip=${SHUNIT_TRUE}; }
# Resume the normal recording behavior of assert and fail calls.
#
# Args:
# None
-endSkipping()
-{
- __shunit_skip=${SHUNIT_FALSE}
-}
+endSkipping() { __shunit_skip=${SHUNIT_FALSE}; }
# Returns the state of assert and fail call skipping.
#
@@ -577,13 +841,10 @@ endSkipping()
# None
# Returns:
# boolean: (TRUE/FALSE constant)
-isSkipping()
-{
- return ${__shunit_skip}
-}
+isSkipping() { return ${__shunit_skip}; }
#-----------------------------------------------------------------------------
-# suite functions
+# Suite functions.
#
# Stub. This function should contains all unit test calls to be made.
@@ -610,8 +871,7 @@ isSkipping()
#
# Args:
# function: string: name of a function to add to current unit test suite
-suite_addTest()
-{
+suite_addTest() {
shunit_func_=${1:-}
__shunit_suite="${__shunit_suite:+${__shunit_suite} }${shunit_func_}"
@@ -653,7 +913,7 @@ suite_addTest()
#
# Args:
# None
-#setUp() { :; }
+#setUp() { :; } # DO NOT UNCOMMENT THIS FUNCTION
# Note: see _shunit_mktempFunc() for actual implementation
# Stub. This function will be called after each test is run.
@@ -668,41 +928,43 @@ suite_addTest()
#tearDown() { :; } # DO NOT UNCOMMENT THIS FUNCTION
#------------------------------------------------------------------------------
-# internal shUnit2 functions
+# Internal shUnit2 functions.
#
# Create a temporary directory to store various run-time files in.
#
# This function is a cross-platform temporary directory creation tool. Not all
-# OSes have the mktemp function, so one is included here.
+# OSes have the `mktemp` function, so one is included here.
#
# Args:
# None
# Outputs:
# string: the temporary directory that was created
-_shunit_mktempDir()
-{
- # try the standard mktemp function
- ( exec mktemp -dqt shunit.XXXXXX 2>/dev/null ) && return
-
- # the standard mktemp didn't work. doing our own.
- if [ -r '/dev/urandom' -a -x '/usr/bin/od' ]; then
- _shunit_random_=`/usr/bin/od -vAn -N4 -tx4 </dev/urandom \
- |sed 's/^[^0-9a-f]*//'`
- elif [ -n "${RANDOM:-}" ]; then
+_shunit_mktempDir() {
+ # Try the standard `mktemp` function.
+ if ( exec mktemp -dqt shunit.XXXXXX 2>/dev/null ); then
+ return
+ fi
+
+ # The standard `mktemp` didn't work. Use our own.
+ # shellcheck disable=SC2039
+ if ${__SHUNIT_BUILTIN} [ -r '/dev/urandom' -a -x '/usr/bin/od' ]; then
+ _shunit_random_=`/usr/bin/od -vAn -N4 -tx4 </dev/urandom |command sed 's/^[^0-9a-f]*//'`
+ elif ${__SHUNIT_BUILTIN} [ -n "${RANDOM:-}" ]; then
# $RANDOM works
_shunit_random_=${RANDOM}${RANDOM}${RANDOM}$$
else
- # $RANDOM doesn't work
+ # `$RANDOM` doesn't work.
_shunit_date_=`date '+%Y%m%d%H%M%S'`
- _shunit_random_=`expr ${_shunit_date_} / $$`
+ _shunit_random_=`expr "${_shunit_date_}" / $$`
fi
_shunit_tmpDir_="${TMPDIR:-/tmp}/shunit.${_shunit_random_}"
- ( umask 077 && mkdir "${_shunit_tmpDir_}" ) || \
- _shunit_fatal 'could not create temporary directory! exiting'
+ if ! ( umask 077 && command mkdir "${_shunit_tmpDir_}" ); then
+ _shunit_fatal 'could not create temporary directory! exiting'
+ fi
- echo ${_shunit_tmpDir_}
+ echo "${_shunit_tmpDir_}"
unset _shunit_date_ _shunit_random_ _shunit_tmpDir_
}
@@ -710,16 +972,15 @@ _shunit_mktempDir()
#
# Args:
# None
-_shunit_mktempFunc()
-{
+_shunit_mktempFunc() {
for _shunit_func_ in oneTimeSetUp oneTimeTearDown setUp tearDown suite noexec
do
_shunit_file_="${__shunit_tmpDir}/${_shunit_func_}"
- cat <<EOF >"${_shunit_file_}"
+ command cat <<EOF >"${_shunit_file_}"
#! /bin/sh
exit ${SHUNIT_TRUE}
EOF
- chmod +x "${_shunit_file_}"
+ command chmod +x "${_shunit_file_}"
done
unset _shunit_file_
@@ -733,32 +994,40 @@ EOF
#
# Args:
# name: string: name of the trap called (specified when trap defined)
-_shunit_cleanup()
-{
+_shunit_cleanup() {
_shunit_name_=$1
- case ${_shunit_name_} in
- EXIT) _shunit_signal_=0 ;;
- INT) _shunit_signal_=2 ;;
- TERM) _shunit_signal_=15 ;;
+ _shunit_signal_=0
+ case "${_shunit_name_}" in
+ EXIT) ;;
+ INT) _shunit_signal_=130 ;; # 2+128
+ TERM) _shunit_signal_=143 ;; # 15+128
*)
- _shunit_warn "unrecognized trap value (${_shunit_name_})"
- _shunit_signal_=0
+ _shunit_error "unrecognized trap value (${_shunit_name_})"
;;
esac
+ if ${__SHUNIT_BUILTIN} [ "${_shunit_name_}" != 'EXIT' ]; then
+ _shunit_warn "trapped and now handling the (${_shunit_name_}) signal"
+ fi
- # do our work
- rm -fr "${__shunit_tmpDir}"
+ # Do our work.
+ if ${__SHUNIT_BUILTIN} [ ${__shunit_clean} -eq ${SHUNIT_FALSE} ]; then
+ # Ensure tear downs are only called once.
+ __shunit_clean=${SHUNIT_TRUE}
- # exit for all non-EXIT signals
- if [ ${_shunit_name_} != 'EXIT' ]; then
- _shunit_warn "trapped and now handling the (${_shunit_name_}) signal"
- # disable EXIT trap
- trap 0
- # add 128 to signal and exit
- exit `expr ${_shunit_signal_} + 128`
- elif [ ${__shunit_reportGenerated} -eq ${SHUNIT_FALSE} ] ; then
- _shunit_assertFail 'Unknown failure encountered running a test'
+ tearDown || _shunit_warn 'tearDown() returned non-zero return code.'
+ oneTimeTearDown || \
+ _shunit_warn 'oneTimeTearDown() returned non-zero return code.'
+
+ command rm -fr "${__shunit_tmpDir}"
+ fi
+
+ if ${__SHUNIT_BUILTIN} [ "${_shunit_name_}" != 'EXIT' ]; then
+ # Handle all non-EXIT signals.
+ trap - 0 # Disable EXIT trap.
+ exit ${_shunit_signal_}
+ elif ${__SHUNIT_BUILTIN} [ ${__shunit_reportGenerated} -eq ${SHUNIT_FALSE} ]; then
+ _shunit_assertFail 'unknown failure encountered running a test'
_shunit_generateReport
exit ${SHUNIT_ERROR}
fi
@@ -766,30 +1035,85 @@ _shunit_cleanup()
unset _shunit_name_ _shunit_signal_
}
+# configureColor based on user color preference.
+#
+# Args:
+# color: string: color mode (one of `always`, `auto`, or `none`).
+_shunit_configureColor() {
+ _shunit_color_=${SHUNIT_FALSE} # By default, no color.
+ case $1 in
+ 'always') _shunit_color_=${SHUNIT_TRUE} ;;
+ 'auto')
+ if ${__SHUNIT_BUILTIN} [ "`_shunit_colors`" -ge 8 ]; then
+ _shunit_color_=${SHUNIT_TRUE}
+ fi
+ ;;
+ 'none') ;;
+ *) _shunit_fatal "unrecognized color option '$1'" ;;
+ esac
+
+ case ${_shunit_color_} in
+ ${SHUNIT_TRUE})
+ __shunit_ansi_none=${__SHUNIT_ANSI_NONE}
+ __shunit_ansi_red=${__SHUNIT_ANSI_RED}
+ __shunit_ansi_green=${__SHUNIT_ANSI_GREEN}
+ __shunit_ansi_yellow=${__SHUNIT_ANSI_YELLOW}
+ __shunit_ansi_cyan=${__SHUNIT_ANSI_CYAN}
+ ;;
+ ${SHUNIT_FALSE})
+ __shunit_ansi_none=''
+ __shunit_ansi_red=''
+ __shunit_ansi_green=''
+ __shunit_ansi_yellow=''
+ __shunit_ansi_cyan=''
+ ;;
+ esac
+
+ unset _shunit_color_ _shunit_tput_
+}
+
+# colors returns the number of supported colors for the TERM.
+_shunit_colors() {
+ if _shunit_tput_=`${SHUNIT_CMD_TPUT} colors 2>/dev/null`; then
+ echo "${_shunit_tput_}"
+ else
+ echo 16
+ fi
+ unset _shunit_tput_
+}
+
# The actual running of the tests happens here.
#
# Args:
# None
-_shunit_execSuite()
-{
+_shunit_execSuite() {
for _shunit_test_ in ${__shunit_suite}; do
__shunit_testSuccess=${SHUNIT_TRUE}
- # disable skipping
+ # Disable skipping.
endSkipping
- # execute the per-test setup function
- setUp
+ # Execute the per-test setup function.
+ if ! setUp; then
+ _shunit_fatal "setup() returned non-zero return code."
+ fi
- # execute the test
- echo "${_shunit_test_}"
- eval ${_shunit_test_}
+ # Execute the test.
+ echo "${__SHUNIT_TEST_PREFIX}${_shunit_test_}"
+ # shellcheck disable=SC2086
+ if ! eval ${_shunit_test_}; then
+ _shunit_error "${_shunit_test_}() returned non-zero return code."
+ __shunit_testSuccess=${SHUNIT_ERROR}
+ _shunit_incFailedCount
+ fi
- # execute the per-test tear-down function
- tearDown
+ # Execute the per-test tear-down function.
+ if ! tearDown; then
+ _shunit_fatal "tearDown() returned non-zero return code."
+ fi
- # update stats
- if [ ${__shunit_testSuccess} -eq ${SHUNIT_TRUE} ]; then
+ # Update stats.
+ if ${__SHUNIT_BUILTIN} [ ${__shunit_testSuccess} -eq ${SHUNIT_TRUE} ]; then
__shunit_testsPassed=`expr ${__shunit_testsPassed} + 1`
else
__shunit_testsFailed=`expr ${__shunit_testsFailed} + 1`
@@ -805,45 +1129,45 @@ _shunit_execSuite()
# None
# Output:
# string: the report of successful and failed tests, as well as totals.
-_shunit_generateReport()
-{
+_shunit_generateReport() {
+ if ${__SHUNIT_BUILTIN} [ "${__shunit_reportGenerated}" -eq ${SHUNIT_TRUE} ]; then
+ return
+ fi
+
_shunit_ok_=${SHUNIT_TRUE}
- # if no exit code was provided one, determine an appropriate one
- [ ${__shunit_testsFailed} -gt 0 \
- -o ${__shunit_testSuccess} -eq ${SHUNIT_FALSE} ] \
- && _shunit_ok_=${SHUNIT_FALSE}
+ # If no exit code was provided, determine an appropriate one.
+ if ${__SHUNIT_BUILTIN} [ "${__shunit_testsFailed}" -gt 0 -o ${__shunit_testSuccess} -eq ${SHUNIT_FALSE} ]; then
+ _shunit_ok_=${SHUNIT_FALSE}
+ fi
echo
- if [ ${__shunit_testsTotal} -eq 1 ]; then
- echo "Ran ${__shunit_testsTotal} test."
+ _shunit_msg_="Ran ${__shunit_ansi_cyan}${__shunit_testsTotal}${__shunit_ansi_none}"
+ if ${__SHUNIT_BUILTIN} [ "${__shunit_testsTotal}" -eq 1 ]; then
+ ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_} test."
else
- echo "Ran ${__shunit_testsTotal} tests."
+ ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_} tests."
fi
- _shunit_failures_=''
- _shunit_skipped_=''
- [ ${__shunit_assertsFailed} -gt 0 ] \
- && _shunit_failures_="failures=${__shunit_assertsFailed}"
- [ ${__shunit_assertsSkipped} -gt 0 ] \
- && _shunit_skipped_="skipped=${__shunit_assertsSkipped}"
-
- if [ ${_shunit_ok_} -eq ${SHUNIT_TRUE} ]; then
- _shunit_msg_='OK'
- [ -n "${_shunit_skipped_}" ] \
- && _shunit_msg_="${_shunit_msg_} (${_shunit_skipped_})"
+ if ${__SHUNIT_BUILTIN} [ ${_shunit_ok_} -eq ${SHUNIT_TRUE} ]; then
+ _shunit_msg_="${__shunit_ansi_green}OK${__shunit_ansi_none}"
+ if ${__SHUNIT_BUILTIN} [ "${__shunit_assertsSkipped}" -gt 0 ]; then
+ _shunit_msg_="${_shunit_msg_} (${__shunit_ansi_yellow}skipped=${__shunit_assertsSkipped}${__shunit_ansi_none})"
+ fi
else
- _shunit_msg_="FAILED (${_shunit_failures_}"
- [ -n "${_shunit_skipped_}" ] \
- && _shunit_msg_="${_shunit_msg_},${_shunit_skipped_}"
+ _shunit_msg_="${__shunit_ansi_red}FAILED${__shunit_ansi_none}"
+ _shunit_msg_="${_shunit_msg_} (${__shunit_ansi_red}failures=${__shunit_assertsFailed}${__shunit_ansi_none}"
+ if ${__SHUNIT_BUILTIN} [ "${__shunit_assertsSkipped}" -gt 0 ]; then
+ _shunit_msg_="${_shunit_msg_},${__shunit_ansi_yellow}skipped=${__shunit_assertsSkipped}${__shunit_ansi_none}"
+ fi
_shunit_msg_="${_shunit_msg_})"
fi
echo
- echo ${_shunit_msg_}
+ ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_}"
__shunit_reportGenerated=${SHUNIT_TRUE}
- unset _shunit_failures_ _shunit_msg_ _shunit_ok_ _shunit_skipped_
+ unset _shunit_msg_ _shunit_ok_
}
# Test for whether a function should be skipped.
@@ -852,9 +1176,10 @@ _shunit_generateReport()
# None
# Returns:
# boolean: whether the test should be skipped (TRUE/FALSE constant)
-_shunit_shouldSkip()
-{
- [ ${__shunit_skip} -eq ${SHUNIT_FALSE} ] && return ${SHUNIT_FALSE}
+_shunit_shouldSkip() {
+ if test ${__shunit_skip} -eq ${SHUNIT_FALSE}; then
+ return ${SHUNIT_FALSE}
+ fi
_shunit_assertSkip
}
@@ -862,8 +1187,7 @@ _shunit_shouldSkip()
#
# Args:
# None
-_shunit_assertPass()
-{
+_shunit_assertPass() {
__shunit_assertsPassed=`expr ${__shunit_assertsPassed} + 1`
__shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1`
}
@@ -872,26 +1196,44 @@ _shunit_assertPass()
#
# Args:
# message: string: failure message to provide user
-_shunit_assertFail()
-{
- _shunit_msg_=$1
-
+_shunit_assertFail() {
__shunit_testSuccess=${SHUNIT_FALSE}
- __shunit_assertsFailed=`expr ${__shunit_assertsFailed} + 1`
- __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1`
- echo "${__SHUNIT_ASSERT_MSG_PREFIX}${_shunit_msg_}"
+ _shunit_incFailedCount
- unset _shunit_msg_
+ if ${__SHUNIT_BUILTIN} [ $# -gt 0 ]; then
+ ${__SHUNIT_CMD_ECHO_ESC} "${__shunit_ansi_red}ASSERT:${__shunit_ansi_none}$*"
+ fi
+}
+
+# Increment the count of failed asserts.
+#
+# Args:
+# none
+_shunit_incFailedCount() {
+ __shunit_assertsFailed=`expr "${__shunit_assertsFailed}" + 1`
+ __shunit_assertsTotal=`expr "${__shunit_assertsTotal}" + 1`
}
# Records a skipped test.
#
# Args:
# None
-_shunit_assertSkip()
-{
- __shunit_assertsSkipped=`expr ${__shunit_assertsSkipped} + 1`
- __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1`
+_shunit_assertSkip() {
+ __shunit_assertsSkipped=`expr "${__shunit_assertsSkipped}" + 1`
+ __shunit_assertsTotal=`expr "${__shunit_assertsTotal}" + 1`
+}
+
+# Dump the current test metrics.
+#
+# Args:
+# none
+_shunit_metrics() {
+ echo "< \
+total: ${__shunit_assertsTotal} \
+passed: ${__shunit_assertsPassed} \
+failed: ${__shunit_assertsFailed} \
+skipped: ${__shunit_assertsSkipped} \
+>"
}
# Prepare a script filename for sourcing.
@@ -900,8 +1242,7 @@ _shunit_assertSkip()
# script: string: path to a script to source
# Returns:
# string: filename prefixed with ./ (if necessary)
-_shunit_prepForSourcing()
-{
+_shunit_prepForSourcing() {
_shunit_script_=$1
case "${_shunit_script_}" in
/*|./*) echo "${_shunit_script_}" ;;
@@ -917,18 +1258,19 @@ _shunit_prepForSourcing()
# s: string: to escape character in
# Returns:
# string: with escaped character(s)
-_shunit_escapeCharInStr()
-{
- [ -n "$2" ] || return # no point in doing work on an empty string
+_shunit_escapeCharInStr() {
+ if ${__SHUNIT_BUILTIN} [ -z "$2" ]; then
+ return # No point in doing work on an empty string.
+ fi
# Note: using shorter variable names to prevent conflicts with
# _shunit_escapeCharactersInString().
_shunit_c_=$1
_shunit_s_=$2
-
- # escape the character
- echo ''${_shunit_s_}'' |sed 's/\'${_shunit_c_}'/\\\'${_shunit_c_}'/g'
+ # Escape the character.
+ # shellcheck disable=SC1003,SC2086
+ echo ''${_shunit_s_}'' |command sed 's/\'${_shunit_c_}'/\\\'${_shunit_c_}'/g'
unset _shunit_c_ _shunit_s_
}
@@ -939,9 +1281,10 @@ _shunit_escapeCharInStr()
# str: string: to escape characters in
# Returns:
# string: with escaped character(s)
-_shunit_escapeCharactersInString()
-{
- [ -n "$1" ] || return # no point in doing work on an empty string
+_shunit_escapeCharactersInString() {
+ if ${__SHUNIT_BUILTIN} [ -z "$1" ]; then
+ return # No point in doing work on an empty string.
+ fi
_shunit_str_=$1
@@ -961,88 +1304,113 @@ _shunit_escapeCharactersInString()
# script: string: name of script to extract functions from
# Returns:
# string: of function names
-_shunit_extractTestFunctions()
-{
+_shunit_extractTestFunctions() {
_shunit_script_=$1
- # extract the lines with test function names, strip of anything besides the
+ # Extract the lines with test function names, strip of anything besides the
# function name, and output everything on a single line.
- _shunit_regex_='^[ ]*(function )*test[A-Za-z0-9_]* *\(\)'
+ _shunit_regex_='^\s*((function test[A-Za-z0-9_-]*)|(test[A-Za-z0-9_-]* *\(\)))'
+ # shellcheck disable=SC2196
egrep "${_shunit_regex_}" "${_shunit_script_}" \
- |sed 's/^[^A-Za-z0-9_]*//;s/^function //;s/\([A-Za-z0-9_]*\).*/\1/g' \
+ |command sed 's/^[^A-Za-z0-9_-]*//;s/^function //;s/\([A-Za-z0-9_-]*\).*/\1/g' \
|xargs
unset _shunit_regex_ _shunit_script_
}
#------------------------------------------------------------------------------
-# main
+# Main.
#
-# determine the operating mode
-if [ $# -eq 0 ]; then
+# Determine the operating mode.
+if ${__SHUNIT_BUILTIN} [ $# -eq 0 -o "${1:-}" = '--' ]; then
__shunit_script=${__SHUNIT_PARENT}
__shunit_mode=${__SHUNIT_MODE_SOURCED}
else
__shunit_script=$1
- [ -r "${__shunit_script}" ] || \
- _shunit_fatal "unable to read from ${__shunit_script}"
+ if ! ${__SHUNIT_BUILTIN} [ -r "${__shunit_script}" ]; then
+ _shunit_fatal "unable to read from ${__shunit_script}"
+ fi
__shunit_mode=${__SHUNIT_MODE_STANDALONE}
fi
-# create a temporary storage location
+# Create a temporary storage location.
__shunit_tmpDir=`_shunit_mktempDir`
-# provide a public temporary directory for unit test scripts
-# TODO(kward): document this
+# Provide a public temporary directory for unit test scripts.
+# TODO(kward): document this.
SHUNIT_TMPDIR="${__shunit_tmpDir}/tmp"
-mkdir "${SHUNIT_TMPDIR}"
+if ! command mkdir "${SHUNIT_TMPDIR}"; then
+ _shunit_fatal "error creating SHUNIT_TMPDIR '${SHUNIT_TMPDIR}'"
+fi
-# setup traps to clean up after ourselves
+# Setup traps to clean up after ourselves.
trap '_shunit_cleanup EXIT' 0
trap '_shunit_cleanup INT' 2
trap '_shunit_cleanup TERM' 15
-# create phantom functions to work around issues with Cygwin
+# Create phantom functions to work around issues with Cygwin.
_shunit_mktempFunc
PATH="${__shunit_tmpDir}:${PATH}"
-# make sure phantom functions are executable. this will bite if /tmp (or the
-# current $TMPDIR) points to a path on a partition that was mounted with the
-# 'noexec' option. the noexec command was created with _shunit_mktempFunc().
+# Make sure phantom functions are executable. This will bite if `/tmp` (or the
+# current `$TMPDIR`) points to a path on a partition that was mounted with the
+# 'noexec' option. The noexec command was created with `_shunit_mktempFunc()`.
noexec 2>/dev/null || _shunit_fatal \
- 'please declare TMPDIR with path on partition with exec permission'
+ 'Please declare TMPDIR with path on partition with exec permission.'
-# we must manually source the tests in standalone mode
-if [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then
- . "`_shunit_prepForSourcing \"${__shunit_script}\"`"
+# We must manually source the tests in standalone mode.
+if ${__SHUNIT_BUILTIN} [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then
+ # shellcheck disable=SC1090
+ ${__SHUNIT_BUILTIN} . "`_shunit_prepForSourcing \"${__shunit_script}\"`"
fi
-# execute the oneTimeSetUp function (if it exists)
-oneTimeSetUp
+# Configure default output coloring behavior.
+_shunit_configureColor "${SHUNIT_COLOR}"
-# execute the suite function defined in the parent test script
-# deprecated as of 2.1.0
-suite
+# Execute the oneTimeSetUp function (if it exists).
+if ! oneTimeSetUp; then
+ _shunit_fatal "oneTimeSetUp() returned non-zero return code."
+fi
-# if no suite function was defined, dynamically build a list of functions
-if [ -z "${__shunit_suite}" ]; then
+# Command line selected tests or suite selected tests
+if ${__SHUNIT_BUILTIN} [ "$#" -ge 2 ]; then
+ # Argument $1 is either the filename of tests or '--'; either way, skip it.
+ shift
+ # Remaining arguments ($2 .. $#) are assumed to be test function names.
+ # Interate through all remaining args in "$@" in a POSIX (likely portable) way.
+ # Helpful tip: https://unix.stackexchange.com/questions/314032/how-to-use-arguments-like-1-2-in-a-for-loop
+ for _shunit_arg_ do
+ suite_addTest "${_shunit_arg_}"
+ done
+ unset _shunit_arg_
+else
+ # Execute the suite function defined in the parent test script.
+ # DEPRECATED as of 2.1.0.
+ suite
+fi
+
+# If no tests or suite specified, dynamically build a list of functions.
+if ${__SHUNIT_BUILTIN} [ -z "${__shunit_suite}" ]; then
shunit_funcs_=`_shunit_extractTestFunctions "${__shunit_script}"`
for shunit_func_ in ${shunit_funcs_}; do
- suite_addTest ${shunit_func_}
+ suite_addTest "${shunit_func_}"
done
fi
unset shunit_func_ shunit_funcs_
-# execute the tests
+# Execute the suite of unit tests.
_shunit_execSuite
-# execute the oneTimeTearDown function (if it exists)
-oneTimeTearDown
+# Execute the oneTimeTearDown function (if it exists).
+if ! oneTimeTearDown; then
+ _shunit_fatal "oneTimeTearDown() returned non-zero return code."
+fi
-# generate the report
+# Generate a report summary.
_shunit_generateReport
-# that's it folks
-[ ${__shunit_testsFailed} -eq 0 ]
-exit $?
+# That's it folks.
+if ! ${__SHUNIT_BUILTIN} [ "${__shunit_testsFailed}" -eq 0 ]; then
+ return ${SHUNIT_FALSE}
+fi
diff --git a/lib/versions b/lib/versions
index 54c8b1f..b5533ab 100755
--- a/lib/versions
+++ b/lib/versions
@@ -1,22 +1,27 @@
#! /bin/sh
-# $Id$
# vim:et:ft=sh:sts=2:sw=2
#
-# Copyright 2008-2016 Kate Ward. All Rights Reserved.
-# Released under the Apache License.
+# Versions determines the versions of all installed shells.
+#
+# Copyright 2008-2020 Kate Ward. All Rights Reserved.
+# Released under the Apache 2.0 License.
#
# Author: kate.ward@forestent.com (Kate Ward)
+# https://github.com/kward/shlib
#
# This library provides reusable functions that determine actual names and
# versions of installed shells and the OS. The library can also be run as a
-# script if set execuatable.
+# script if set executable.
+#
+# Disable checks that aren't fully portable (POSIX != portable).
+# shellcheck disable=SC2006
ARGV0=`basename "$0"`
LSB_RELEASE='/etc/lsb-release'
-VERSIONS_SHELLS="/bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/sh /bin/zsh"
+VERSIONS_SHELLS='ash /bin/bash /bin/dash /bin/ksh /bin/mksh /bin/pdksh /bin/zsh /usr/xpg4/bin/sh /bin/sh /sbin/sh'
-TRUE=0
-FALSE=1
+true; TRUE=$?
+false; FALSE=$?
ERROR=2
UNAME_R=`uname -r`
@@ -24,34 +29,50 @@ UNAME_S=`uname -s`
__versions_haveStrings=${ERROR}
-#------------------------------------------------------------------------------
-# functions
-#
-
-versions_osName()
-{
+versions_osName() {
os_name_='unrecognized'
os_system_=${UNAME_S}
+ os_release_=${UNAME_R}
case ${os_system_} in
CYGWIN_NT-*) os_name_='Cygwin' ;;
- Darwin) os_name_='Mac OS X' ;;
+ Darwin)
+ os_name_=`/usr/bin/sw_vers -productName`
+ os_version_=`versions_osVersion`
+ case ${os_version_} in
+ 10.4|10.4.[0-9]*) os_name_='Mac OS X Tiger' ;;
+ 10.5|10.5.[0-9]*) os_name_='Mac OS X Leopard' ;;
+ 10.6|10.6.[0-9]*) os_name_='Mac OS X Snow Leopard' ;;
+ 10.7|10.7.[0-9]*) os_name_='Mac OS X Lion' ;;
+ 10.8|10.8.[0-9]*) os_name_='Mac OS X Mountain Lion' ;;
+ 10.9|10.9.[0-9]*) os_name_='Mac OS X Mavericks' ;;
+ 10.10|10.10.[0-9]*) os_name_='Mac OS X Yosemite' ;;
+ 10.11|10.11.[0-9]*) os_name_='Mac OS X El Capitan' ;;
+ 10.12|10.12.[0-9]*) os_name_='macOS Sierra' ;;
+ 10.13|10.13.[0-9]*) os_name_='macOS High Sierra' ;;
+ 10.14|10.14.[0-9]*) os_name_='macOS Mojave' ;;
+ 10.15|10.15.[0-9]*) os_name_='macOS Catalina' ;;
+ *) os_name_='macOS' ;;
+ esac
+ ;;
FreeBSD) os_name_='FreeBSD' ;;
Linux) os_name_='Linux' ;;
SunOS)
- if grep 'OpenSolaris' /etc/release >/dev/null; then
- os_name_='OpenSolaris'
- else
- os_name_='Solaris'
+ os_name_='SunOS'
+ if [ -r '/etc/release' ]; then
+ if grep 'OpenSolaris' /etc/release >/dev/null; then
+ os_name_='OpenSolaris'
+ else
+ os_name_='Solaris'
+ fi
fi
;;
esac
echo ${os_name_}
- unset os_name_ os_system_
+ unset os_name_ os_system_ os_release_ os_version_
}
-versions_osVersion()
-{
+versions_osVersion() {
os_version_='unrecognized'
os_system_=${UNAME_S}
os_release_=${UNAME_R}
@@ -60,170 +81,203 @@ versions_osVersion()
os_version_=`expr "${os_release_}" : '\([0-9]*\.[0-9]\.[0-9]*\).*'`
;;
Darwin)
- major_='10'
- sub_=`echo ${os_release_} |sed 's/^[0-9]*\.\([0-9]*\)\.[0-9]*$/\1/'`
- case ${os_release_} in
- 8.*) minor_='4' ;;
- 9.*) minor_='5' ;;
- 10.*) minor_='6' ;;
- 11.*) minor_='7' ;;
- 12.*) minor_='8' ;;
- 13.*) minor_='9' ;;
- 15.*) minor_='10' ;;
- *) minor_='X'; sub_='X' ;;
- esac
- os_version_="${major_}.${minor_}.${sub_}"
+ os_version_=`/usr/bin/sw_vers -productVersion`
;;
FreeBSD)
os_version_=`expr "${os_release_}" : '\([0-9]*\.[0-9]*\)-.*'`
;;
Linux)
- if [ -r "${LSB_RELEASE}" ]; then
+ if [ -r '/etc/os-release' ]; then
+ os_version_=`awk -F= '$1~/PRETTY_NAME/{print $2}' /etc/os-release \
+ |sed 's/"//g'`
+ elif [ -r '/etc/redhat-release' ]; then
+ os_version_=`cat /etc/redhat-release`
+ elif [ -r '/etc/SuSE-release' ]; then
+ os_version_=`head -n 1 /etc/SuSE-release`
+ elif [ -r "${LSB_RELEASE}" ]; then
if grep -q 'DISTRIB_ID=Ubuntu' "${LSB_RELEASE}"; then
+ # shellcheck disable=SC2002
os_version_=`cat "${LSB_RELEASE}" \
|awk -F= '$1~/DISTRIB_DESCRIPTION/{print $2}' \
|sed 's/"//g;s/ /-/g'`
fi
- elif [ -r '/etc/redhat-release' ]; then
- os_version_=`cat /etc/redhat-release`
fi
;;
SunOS)
- if grep 'OpenSolaris' /etc/release >/dev/null; then
- os_version_=`grep 'OpenSolaris' /etc/release |awk '{print $2"("$3")"}'`
- else
- major_=`echo ${os_release_} |sed 's/[0-9]*\.\([0-9]*\)/\1/'`
- minor_=`grep Solaris /etc/release |sed 's/[^u]*\(u[0-9]*\).*/\1/'`
- os_version_="${major_}${minor_}"
+ if [ -r '/etc/release' ]; then
+ if grep 'OpenSolaris' /etc/release >/dev/null; then # OpenSolaris
+ os_version_=`grep 'OpenSolaris' /etc/release |awk '{print $2"("$3")"}'`
+ else # Solaris
+ major_=`echo "${os_release_}" |sed 's/[0-9]*\.\([0-9]*\)/\1/'`
+ minor_=`grep Solaris /etc/release |sed 's/[^u]*\(u[0-9]*\).*/\1/'`
+ os_version_="${major_}${minor_}"
+ fi
fi
;;
esac
- echo ${os_version_}
- unset os_name_ os_release_ os_version_ major_ minor_ sub_
+ echo "${os_version_}"
+ unset os_release_ os_system_ os_version_ major_ minor_
}
-versions_shellVersion()
-{
+versions_shellVersion() {
shell_=$1
- if [ ! -x "${shell_}" ]; then
+ shell_present_=${FALSE}
+ case "${shell_}" in
+ ash) [ -x '/bin/busybox' ] && shell_present_=${TRUE} ;;
+ *) [ -x "${shell_}" ] && shell_present_=${TRUE} ;;
+ esac
+ if [ ${shell_present_} -eq ${FALSE} ]; then
echo 'not installed'
- return
+ return ${FALSE}
fi
version_=''
case ${shell_} in
+ # SunOS shells.
+ /sbin/sh) ;;
+ /usr/xpg4/bin/sh) version_=`versions_shell_xpg4 "${shell_}"` ;;
+
+ # Generic shell.
*/sh)
- # TODO(kward): fix this
- ## this could be one of any number of shells. try until one fits.
- #version_=`versions_shell_bash ${shell_}`
- ## dash cannot be self determined yet
- #[ -z "${version_}" ] && version_=`versions_shell_ksh ${shell_}`
- ## pdksh is covered in versions_shell_ksh()
- #[ -z "${version_}" ] && version_=`versions_shell_zsh ${shell_}`
- ;;
- */bash) version_=`versions_shell_bash ${shell_}` ;;
- */dash)
- # simply assuming Ubuntu Linux until somebody comes up with a better
- # test. the following test will return an empty string if dash is not
- # installed.
- version_=`versions_shell_dash`
+ # This could be one of any number of shells. Try until one fits.
+ version_=''
+ [ -z "${version_}" ] && version_=`versions_shell_bash "${shell_}"`
+ # dash cannot be self determined yet
+ [ -z "${version_}" ] && version_=`versions_shell_ksh "${shell_}"`
+ # pdksh is covered in versions_shell_ksh()
+ [ -z "${version_}" ] && version_=`versions_shell_xpg4 "${shell_}"`
+ [ -z "${version_}" ] && version_=`versions_shell_zsh "${shell_}"`
;;
- */ksh) version_=`versions_shell_ksh ${shell_}` ;;
- */pdksh) version_=`versions_shell_pdksh ${shell_}` ;;
- */zsh) version_=`versions_shell_zsh ${shell_}` ;;
+
+ # Specific shells.
+ ash) version_=`versions_shell_ash "${shell_}"` ;;
+ # bash - Bourne Again SHell (https://www.gnu.org/software/bash/)
+ */bash) version_=`versions_shell_bash "${shell_}"` ;;
+ */dash) version_=`versions_shell_dash` ;;
+ # ksh - KornShell (http://www.kornshell.com/)
+ */ksh) version_=`versions_shell_ksh "${shell_}"` ;;
+ # mksh - MirBSD Korn Shell (http://www.mirbsd.org/mksh.htm)
+ */mksh) version_=`versions_shell_ksh "${shell_}"` ;;
+ # pdksh - Public Domain Korn Shell (http://web.cs.mun.ca/~michael/pdksh/)
+ */pdksh) version_=`versions_shell_pdksh "${shell_}"` ;;
+ # zsh (https://www.zsh.org/)
+ */zsh) version_=`versions_shell_zsh "${shell_}"` ;;
+
+ # Unrecognized shell.
*) version_='invalid'
esac
- echo ${version_:-unknown}
+ echo "${version_:-unknown}"
unset shell_ version_
}
-versions_shell_bash()
-{
- $1 --version 2>&1 |grep 'GNU bash' |sed 's/.*version \([^ ]*\).*/\1/'
+# The ash shell is included in BusyBox.
+versions_shell_ash() {
+ busybox --help |head -1 |sed 's/BusyBox v\([0-9.]*\) .*/\1/'
+}
+
+versions_shell_bash() {
+ $1 --version : 2>&1 |grep 'GNU bash' |sed 's/.*version \([^ ]*\).*/\1/'
}
-versions_shell_dash()
-{
+# Assuming Ubuntu Linux until somebody comes up with a better test. The
+# following test will return an empty string if dash is not installed.
+versions_shell_dash() {
eval dpkg >/dev/null 2>&1
- [ $? -eq 127 ] && return # return if dpkg not found
+ [ $? -eq 127 ] && return # Return if dpkg not found.
dpkg -l |grep ' dash ' |awk '{print $3}'
}
-versions_shell_ksh()
-{
+versions_shell_ksh() {
versions_shell_=$1
+ versions_version_=''
- # try a few different ways to figure out the version
+ # Try a few different ways to figure out the version.
versions_version_=`${versions_shell_} --version : 2>&1`
+ # shellcheck disable=SC2181
if [ $? -eq 0 ]; then
versions_version_=`echo "${versions_version_}" \
|sed 's/.*\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\).*/\1/'`
else
versions_version_=''
fi
-
+ if [ -z "${versions_version_}" ]; then
+ # shellcheck disable=SC2016
+ versions_version_=`${versions_shell_} -c 'echo ${KSH_VERSION}'`
+ fi
if [ -z "${versions_version_}" ]; then
_versions_have_strings
- versions_version_=`strings ${versions_shell_} 2>&1 \
+ versions_version_=`strings "${versions_shell_}" 2>&1 \
|grep Version \
|sed 's/^.*Version \(.*\)$/\1/;s/ s+ \$$//;s/ /-/g'`
fi
-
if [ -z "${versions_version_}" ]; then
- versions_version_=`versions_shell_pdksh ${versions_shell_}`
+ versions_version_=`versions_shell_pdksh "${versions_shell_}"`
fi
- echo ${versions_version_}
+ echo "${versions_version_}"
unset versions_shell_ versions_version_
}
-versions_shell_pdksh()
-{
+# mksh - MirBSD Korn Shell (http://www.mirbsd.org/mksh.htm)
+# mksh is a successor to pdksh (Public Domain Korn Shell).
+versions_shell_mksh() {
+ versions_shell_ksh
+}
+
+# pdksh - Public Domain Korn Shell
+# pdksh is an obsolete shell, which was replaced by mksh (among others).
+versions_shell_pdksh() {
_versions_have_strings
- strings $1 2>&1 \
+ strings "$1" 2>&1 \
|grep 'PD KSH' \
|sed -e 's/.*PD KSH \(.*\)/\1/;s/ /-/g'
}
-versions_shell_zsh()
-{
+versions_shell_xpg4() {
+ _versions_have_strings
+ strings "$1" 2>&1 \
+ |grep 'Version' \
+ |sed -e 's/^@(#)Version //'
+}
+
+versions_shell_zsh() {
versions_shell_=$1
- # try a few different ways to figure out the version
+ # Try a few different ways to figure out the version.
+ # shellcheck disable=SC2016
versions_version_=`echo 'echo ${ZSH_VERSION}' |${versions_shell_}`
-
if [ -z "${versions_version_}" ]; then
- versions_version_=`${versions_shell_} --version 2>&1 |awk '{print $2}'`
+ versions_version_=`${versions_shell_} --version : 2>&1`
+ # shellcheck disable=SC2181
+ if [ $? -eq 0 ]; then
+ versions_version_=`echo "${versions_version_}" |awk '{print $2}'`
+ else
+ versions_version_=''
+ fi
fi
- echo ${versions_version_}
+ echo "${versions_version_}"
unset versions_shell_ versions_version_
}
# Determine if the 'strings' binary installed.
-_versions_have_strings()
-{
+_versions_have_strings() {
[ ${__versions_haveStrings} -ne ${ERROR} ] && return
- eval strings /dev/null >/dev/null 2>&1
- if [ $? -eq 0 ]; then
+ if eval strings /dev/null >/dev/null 2>&1; then
__versions_haveStrings=${TRUE}
- else
- echo 'WARN: strings not installed. try installing binutils?' >&2
- __versions_haveStrings=${FALSE}
+ return
fi
-}
-#------------------------------------------------------------------------------
-# main
-#
+ echo 'WARN: strings not installed. try installing binutils?' >&2
+ __versions_haveStrings=${FALSE}
+}
-versions_main()
-{
- # treat unset variables as an error
+versions_main() {
+ # Treat unset variables as an error.
set -u
os_name=`versions_osName`
@@ -231,7 +285,7 @@ versions_main()
echo "os: ${os_name} version: ${os_version}"
for shell in ${VERSIONS_SHELLS}; do
- shell_version=`versions_shellVersion ${shell}`
+ shell_version=`versions_shellVersion "${shell}"`
echo "shell: ${shell} version: ${shell_version}"
done
}
diff --git a/lib/shflags b/shflags
index 9e69e64..5cfab3b 100644
--- a/lib/shflags
+++ b/shflags
@@ -1,33 +1,33 @@
-# $Id: shflags 189 2013-01-15 00:13:10Z kate.ward@forestent.com $
# vim:et:ft=sh:sts=2:sw=2
#
-# Copyright 2008 Kate Ward. All Rights Reserved.
-# Released under the LGPL (GNU Lesser General Public License)
+# Copyright 2008-2020 Kate Ward. All Rights Reserved.
+# Released under the Apache License 2.0 license.
+# http://www.apache.org/licenses/LICENSE-2.0
#
-# shFlags -- Advanced command-line flag library for Unix shell scripts.
-# http://code.google.com/p/shflags/
+# shFlags is an advanced command-line flag library for Unix shell scripts.
#
# Author: kate.ward@forestent.com (Kate Ward)
+# https://github.com/kward/shflags
#
-# This module implements something like the google-gflags library available
-# from http://code.google.com/p/google-gflags/.
+# This module implements something like the gflags library available
+# from https://github.com/gflags/gflags.
#
# FLAG TYPES: This is a list of the DEFINE_*'s that you can do. All flags take
# a name, default value, help-string, and optional 'short' name (one-letter
-# name). Some flags have other arguments, which are described with the flag.
+# name). Some flags have other arguments, which are described with the flag.
#
-# DEFINE_string: takes any input, and intreprets it as a string.
+# DEFINE_string: takes any input, and interprets it as a string.
#
# DEFINE_boolean: does not take any arguments. Say --myflag to set
# FLAGS_myflag to true, or --nomyflag to set FLAGS_myflag to false. For short
# flags, passing the flag on the command-line negates the default value, i.e.
# if the default is true, passing the flag sets the value to false.
#
-# DEFINE_float: takes an input and intreprets it as a floating point number. As
+# DEFINE_float: takes an input and interprets it as a floating point number. As
# shell does not support floats per-se, the input is merely validated as
# being a valid floating point value.
#
-# DEFINE_integer: takes an input and intreprets it as an integer.
+# DEFINE_integer: takes an input and interprets it as an integer.
#
# SPECIAL FLAGS: There are a few flags that have special meaning:
# --help (or -?) prints a list of all the flags in a human-readable fashion
@@ -81,28 +81,114 @@
#
# Notes:
# - lists of strings are space separated, and a null value is the '~' char.
-
-# return if FLAGS already loaded
-[ -n "${FLAGS_VERSION:-}" ] && return 0
-FLAGS_VERSION='1.0.4pre'
-
-# return values that scripts can use
+#
+### ShellCheck (http://www.shellcheck.net/)
+# expr may be antiquated, but it is the only solution in some cases.
+# shellcheck disable=SC2003
+# $() are not fully portable (POSIX != portable).
+# shellcheck disable=SC2006
+# [ p -a q ] are well defined enough (vs [ p ] && [ q ]).
+# shellcheck disable=SC2166
+
+# Return if FLAGS already loaded.
+if [ -n "${FLAGS_VERSION:-}" ]; then return 0; fi
+FLAGS_VERSION='1.4.0pre'
+
+# Return values that scripts can use.
FLAGS_TRUE=0
FLAGS_FALSE=1
FLAGS_ERROR=2
-# determine some reasonable command defaults
-__FLAGS_UNAME_S=`uname -s`
-case "${__FLAGS_UNAME_S}" in
- BSD) __FLAGS_EXPR_CMD='gexpr' ;;
- *) __FLAGS_EXPR_CMD='expr' ;;
-esac
+# shlib_expr_cmd determines a reasonable default `expr` command.
+# https://github.com/kward/shlib
+#
+# Use like:
+# EXPR_CMD=$(shlib_expr_cmd)
+# ${EXPR_CMD} 1 + 1
+#
+# Args:
+# none
+# Output:
+# string: expr command
+# Return
+# int: 0 upon success
+shlib_expr_cmd() {
+ if [ "$(uname -s)" = 'BSD' ]; then
+ echo 'gexpr --'
+ return 0
+ fi
+
+ _shlib_expr_cmd_='expr --'
+ # shellcheck disable=SC2003
+ if _shlib_output_=$(${_shlib_expr_cmd_} 2>&1); then
+ if [ "${_shlib_output_}" = '--' ]; then
+ # We are likely running inside BusyBox.
+ _shlib_expr_cmd_='expr'
+ fi
+ fi
-# commands a user can override if needed
+ echo "${_shlib_expr_cmd_}"
+ unset _shlib_expr_cmd_ _shlib_output_
+}
+__FLAGS_EXPR_CMD=`shlib_expr_cmd`
+
+# Commands a user can override if desired.
FLAGS_EXPR_CMD=${FLAGS_EXPR_CMD:-${__FLAGS_EXPR_CMD}}
FLAGS_GETOPT_CMD=${FLAGS_GETOPT_CMD:-getopt}
-# specific shell checks
+#
+# Logging functions.
+#
+
+# Logging levels.
+FLAGS_LEVEL_DEBUG=0
+FLAGS_LEVEL_INFO=1
+FLAGS_LEVEL_WARN=2
+FLAGS_LEVEL_ERROR=3
+FLAGS_LEVEL_FATAL=4
+__FLAGS_LEVEL_DEFAULT=${FLAGS_LEVEL_WARN}
+__flags_level=${__FLAGS_LEVEL_DEFAULT} # Current logging level.
+
+_flags_debug() {
+ if [ ${__flags_level} -le ${FLAGS_LEVEL_DEBUG} ]; then echo "flags:DEBUG $*" >&2; fi
+}
+_flags_info() {
+ if [ ${__flags_level} -le ${FLAGS_LEVEL_INFO} ]; then echo "flags:INFO $*" >&2; fi
+}
+_flags_warn() {
+ if [ ${__flags_level} -le ${FLAGS_LEVEL_WARN} ]; then echo "flags:WARN $*" >&2; fi
+}
+_flags_error() {
+ if [ ${__flags_level} -le ${FLAGS_LEVEL_ERROR} ]; then echo "flags:ERROR $*" >&2; fi
+}
+_flags_fatal() {
+ echo "flags:FATAL $*" >&2
+ exit ${FLAGS_ERROR}
+}
+
+# Get the logging level.
+flags_loggingLevel() { echo ${__flags_level}; }
+
+# Set the logging level by overriding the `__flags_level` variable.
+#
+# Args:
+# _flags_level_: integer: new logging level
+# Returns:
+# nothing
+flags_setLoggingLevel() {
+ [ $# -ne 1 ] && _flags_fatal "flags_setLevel(): logging level missing"
+ _flags_level_=$1
+ if ! [ "${_flags_level_}" -ge "${FLAGS_LEVEL_DEBUG}" -a "${_flags_level_}" -le "${FLAGS_LEVEL_FATAL}" ]; then
+ _flags_fatal "Invalid logging level '${_flags_level_}' specified."
+ fi
+ __flags_level=$1
+ unset _flags_level_
+}
+
+#
+# Shell checks.
+#
+
if [ -n "${ZSH_VERSION:-}" ]; then
setopt |grep "^shwordsplit$" >/dev/null
if [ $? -ne ${FLAGS_TRUE} ]; then
@@ -114,7 +200,7 @@ if [ -n "${ZSH_VERSION:-}" ]; then
fi
fi
-# can we use built-ins?
+# Can we use built-ins?
( echo "${FLAGS_TRUE#0}"; ) >/dev/null 2>&1
if [ $? -eq ${FLAGS_TRUE} ]; then
__FLAGS_USE_BUILTIN=${FLAGS_TRUE}
@@ -123,31 +209,30 @@ else
fi
#
-# constants
+# Constants.
#
-# reserved flag names
-__FLAGS_RESERVED_LIST=' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE '
+# Reserved flag names.
+__FLAGS_RESERVED_LIST=' ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE '
__FLAGS_RESERVED_LIST="${__FLAGS_RESERVED_LIST} VERSION "
-# getopt version
+# Determined getopt version (standard or enhanced).
__FLAGS_GETOPT_VERS_STD=0
__FLAGS_GETOPT_VERS_ENH=1
-__FLAGS_GETOPT_VERS_BSD=2
-
-${FLAGS_GETOPT_CMD} >/dev/null 2>&1
-case $? in
- 0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;; # bsd getopt
- 2)
- # TODO(kward): look into '-T' option to test the internal getopt() version
- if [ "`${FLAGS_GETOPT_CMD} --version`" = '-- ' ]; then
- __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD}
- else
- __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_ENH}
- fi
- ;;
- *) _flags_fatal 'unable to determine getopt version' ;;
-esac
+
+# shellcheck disable=SC2120
+_flags_getopt_vers() {
+ _flags_getopt_cmd_=${1:-${FLAGS_GETOPT_CMD}}
+ case "`${_flags_getopt_cmd_} -lfoo '' --foo 2>&1`" in
+ ' -- --foo') echo ${__FLAGS_GETOPT_VERS_STD} ;;
+ ' --foo --') echo ${__FLAGS_GETOPT_VERS_ENH} ;;
+ # Unrecognized output. Assuming standard getopt version.
+ *) echo ${__FLAGS_GETOPT_VERS_STD} ;;
+ esac
+ unset _flags_getopt_cmd_
+}
+# shellcheck disable=SC2119
+__FLAGS_GETOPT_VERS=`_flags_getopt_vers`
# getopt optstring lengths
__FLAGS_OPTSTR_SHORT=0
@@ -155,65 +240,58 @@ __FLAGS_OPTSTR_LONG=1
__FLAGS_NULL='~'
-# flag info strings
+# Flag info strings.
__FLAGS_INFO_DEFAULT='default'
__FLAGS_INFO_HELP='help'
__FLAGS_INFO_SHORT='short'
__FLAGS_INFO_TYPE='type'
-# flag lengths
+# Flag lengths.
__FLAGS_LEN_SHORT=0
__FLAGS_LEN_LONG=1
-# flag types
+# Flag types.
__FLAGS_TYPE_NONE=0
__FLAGS_TYPE_BOOLEAN=1
__FLAGS_TYPE_FLOAT=2
__FLAGS_TYPE_INTEGER=3
__FLAGS_TYPE_STRING=4
-# set the constants readonly
+# Set the constants readonly.
__flags_constants=`set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'`
for __flags_const in ${__flags_constants}; do
- # skip certain flags
+ # Skip certain flags.
case ${__flags_const} in
FLAGS_HELP) continue ;;
FLAGS_PARENT) continue ;;
esac
- # set flag readonly
+ # Set flag readonly.
if [ -z "${ZSH_VERSION:-}" ]; then
- readonly ${__flags_const}
- else # handle zsh
- case ${ZSH_VERSION} in
- [123].*) readonly ${__flags_const} ;;
- *) readonly -g ${__flags_const} ;; # declare readonly constants globally
- esac
+ readonly "${__flags_const}"
+ continue
fi
+ case ${ZSH_VERSION} in
+ [123].*) readonly "${__flags_const}" ;;
+ *)
+ # Declare readonly constants globally.
+ # shellcheck disable=SC2039
+ readonly -g "${__flags_const}" ;;
+ esac
done
unset __flags_const __flags_constants
#
-# internal variables
+# Internal variables.
#
-# space separated lists
-__flags_boolNames=' ' # boolean flag names
-__flags_longNames=' ' # long flag names
-__flags_shortNames=' ' # short flag names
-__flags_definedNames=' ' # defined flag names (used for validation)
-
-__flags_columns='' # screen width in columns
-__flags_opts='' # temporary storage for parsed getopt flags
-
-#------------------------------------------------------------------------------
-# private functions
-#
+# Space separated lists.
+__flags_boolNames=' ' # Boolean flag names.
+__flags_longNames=' ' # Long flag names.
+__flags_shortNames=' ' # Short flag names.
+__flags_definedNames=' ' # Defined flag names (used for validation).
-# logging functions
-_flags_debug() { echo "flags:DEBUG $@" >&2; }
-_flags_warn() { echo "flags:WARN $@" >&2; }
-_flags_error() { echo "flags:ERROR $@" >&2; }
-_flags_fatal() { echo "flags:FATAL $@" >&2; exit ${FLAGS_ERROR}; }
+__flags_columns='' # Screen width in columns.
+__flags_opts='' # Temporary storage for parsed getopt flags.
# Define a flag.
#
@@ -226,15 +304,14 @@ _flags_fatal() { echo "flags:FATAL $@" >&2; exit ${FLAGS_ERROR}; }
# __flags_flagname_type - the type of flag (one of __FLAGS_TYPE_*)
#
# Args:
-# _flags__type: integer: internal type of flag (__FLAGS_TYPE_*)
-# _flags__name: string: long flag name
-# _flags__default: default flag value
-# _flags__help: string: help string
-# _flags__short: string: (optional) short flag name
+# _flags_type_: integer: internal type of flag (__FLAGS_TYPE_*)
+# _flags_name_: string: long flag name
+# _flags_default_: default flag value
+# _flags_help_: string: help string
+# _flags_short_: string: (optional) short flag name
# Returns:
# integer: success of operation, or error
-_flags_define()
-{
+_flags_define() {
if [ $# -lt 4 ]; then
flags_error='DEFINE error: too few arguments'
flags_return=${FLAGS_ERROR}
@@ -245,50 +322,51 @@ _flags_define()
_flags_type_=$1
_flags_name_=$2
_flags_default_=$3
- _flags_help_=$4
+ _flags_help_=${4:-§} # Special value '§' indicates no help string provided.
_flags_short_=${5:-${__FLAGS_NULL}}
+ _flags_debug "type:${_flags_type_} name:${_flags_name_}" \
+ "default:'${_flags_default_}' help:'${_flags_help_}'" \
+ "short:${_flags_short_}"
+
_flags_return_=${FLAGS_TRUE}
- _flags_usName_=`_flags_underscoreName ${_flags_name_}`
+ _flags_usName_="`_flags_underscoreName "${_flags_name_}"`"
- # check whether the flag name is reserved
- _flags_itemInList ${_flags_usName_} "${__FLAGS_RESERVED_LIST}"
- if [ $? -eq ${FLAGS_TRUE} ]; then
+ # Check whether the flag name is reserved.
+ if _flags_itemInList "${_flags_usName_}" "${__FLAGS_RESERVED_LIST}"; then
flags_error="flag name (${_flags_name_}) is reserved"
_flags_return_=${FLAGS_ERROR}
fi
- # require short option for getopt that don't support long options
+ # Require short option for getopt that don't support long options.
if [ ${_flags_return_} -eq ${FLAGS_TRUE} \
- -a ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} \
+ -a "${__FLAGS_GETOPT_VERS}" -ne "${__FLAGS_GETOPT_VERS_ENH}" \
-a "${_flags_short_}" = "${__FLAGS_NULL}" ]
then
flags_error="short flag required for (${_flags_name_}) on this platform"
_flags_return_=${FLAGS_ERROR}
fi
- # check for existing long name definition
+ # Check for existing long name definition.
if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
- if _flags_itemInList ${_flags_usName_} ${__flags_definedNames}; then
+ if _flags_itemInList "${_flags_usName_}" "${__flags_definedNames}"; then
flags_error="definition for ([no]${_flags_name_}) already exists"
_flags_warn "${flags_error}"
_flags_return_=${FLAGS_FALSE}
fi
fi
- # check for existing short name definition
- if [ ${_flags_return_} -eq ${FLAGS_TRUE} \
- -a "${_flags_short_}" != "${__FLAGS_NULL}" ]
- then
- if _flags_itemInList "${_flags_short_}" ${__flags_shortNames}; then
+ # Check for existing short name definition.
+ if [ ${_flags_return_} -eq ${FLAGS_TRUE} -a "${_flags_short_}" != "${__FLAGS_NULL}" ]; then
+ if _flags_itemInList "${_flags_short_}" "${__flags_shortNames}"; then
flags_error="flag short name (${_flags_short_}) already defined"
_flags_warn "${flags_error}"
_flags_return_=${FLAGS_FALSE}
fi
fi
- # handle default value. note, on several occasions the 'if' portion of an
- # if/then/else contains just a ':' which does nothing. a binary reversal via
+ # Handle default value. Note, on several occasions the 'if' portion of an
+ # if/then/else contains just a ':' which does nothing. A binary reversal via
# '!' is not done because it does not work on all shells.
if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
case ${_flags_type_} in
@@ -322,7 +400,7 @@ _flags_define()
fi
;;
- ${__FLAGS_TYPE_STRING}) ;; # everything in shell is a valid string
+ ${__FLAGS_TYPE_STRING}) ;; # Everything in shell is a valid string.
*)
flags_error="unrecognized flag type '${_flags_type_}'"
@@ -332,7 +410,7 @@ _flags_define()
fi
if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
- # store flag information
+ # Store flag information.
eval "FLAGS_${_flags_usName_}='${_flags_default_}'"
eval "__flags_${_flags_usName_}_${__FLAGS_INFO_TYPE}=${_flags_type_}"
eval "__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}=\
@@ -343,12 +421,12 @@ _flags_define()
# append flag names to name lists
__flags_shortNames="${__flags_shortNames}${_flags_short_} "
__flags_longNames="${__flags_longNames}${_flags_name_} "
- [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \
+ [ "${_flags_type_}" -eq "${__FLAGS_TYPE_BOOLEAN}" ] && \
__flags_boolNames="${__flags_boolNames}no${_flags_name_} "
- # append flag names to defined names for later validation checks
+ # Append flag names to defined names for later validation checks.
__flags_definedNames="${__flags_definedNames}${_flags_usName_} "
- [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \
+ [ "${_flags_type_}" -eq "${__FLAGS_TYPE_BOOLEAN}" ] && \
__flags_definedNames="${__flags_definedNames}no${_flags_usName_} "
fi
@@ -365,9 +443,8 @@ _flags_define()
# unnamed: string: log flag name
# Output:
# string: underscored name
-_flags_underscoreName()
-{
- echo $1 |tr '-' '_'
+_flags_underscoreName() {
+ echo "$1" |tr z- z_
}
# Return valid getopt options using currently defined list of long options.
@@ -381,24 +458,25 @@ _flags_underscoreName()
# string: generated option string for getopt
# Returns:
# boolean: success of operation (always returns True)
-_flags_genOptStr()
-{
+_flags_genOptStr() {
_flags_optStrType_=$1
_flags_opts_=''
for _flags_name_ in ${__flags_longNames}; do
- _flags_usName_=`_flags_underscoreName ${_flags_name_}`
- _flags_type_=`_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}`
- [ $? -eq ${FLAGS_TRUE} ] || _flags_fatal 'call to _flags_type_ failed'
+ _flags_usName_="`_flags_underscoreName "${_flags_name_}"`"
+ _flags_type_="`_flags_getFlagInfo "${_flags_usName_}" "${__FLAGS_INFO_TYPE}"`"
+ if [ $? -ne ${FLAGS_TRUE} ]; then
+ _flags_fatal 'call to _flags_type_ failed'
+ fi
case ${_flags_optStrType_} in
${__FLAGS_OPTSTR_SHORT})
- _flags_shortName_=`_flags_getFlagInfo \
- ${_flags_usName_} ${__FLAGS_INFO_SHORT}`
+ _flags_shortName_="`_flags_getFlagInfo \
+ "${_flags_usName_}" "${__FLAGS_INFO_SHORT}"`"
if [ "${_flags_shortName_}" != "${__FLAGS_NULL}" ]; then
_flags_opts_="${_flags_opts_}${_flags_shortName_}"
- # getopt needs a trailing ':' to indicate a required argument
- [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \
+ # getopt needs a trailing ':' to indicate a required argument.
+ [ "${_flags_type_}" -ne "${__FLAGS_TYPE_BOOLEAN}" ] && \
_flags_opts_="${_flags_opts_}:"
fi
;;
@@ -406,7 +484,7 @@ _flags_genOptStr()
${__FLAGS_OPTSTR_LONG})
_flags_opts_="${_flags_opts_:+${_flags_opts_},}${_flags_name_}"
# getopt needs a trailing ':' to indicate a required argument
- [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \
+ [ "${_flags_type_}" -ne "${__FLAGS_TYPE_BOOLEAN}" ] && \
_flags_opts_="${_flags_opts_}:"
;;
esac
@@ -427,30 +505,39 @@ _flags_genOptStr()
# string: value of dereferenced flag variable
# Returns:
# integer: one of FLAGS_{TRUE|FALSE|ERROR}
-_flags_getFlagInfo()
-{
- # note: adding gFI to variable names to prevent naming conflicts with calling
+_flags_getFlagInfo() {
+ # Note: adding gFI to variable names to prevent naming conflicts with calling
# functions
_flags_gFI_usName_=$1
_flags_gFI_info_=$2
+ # Example: given argument usName (underscored flag name) of 'my_flag', and
+ # argument info of 'help', set the _flags_infoValue_ variable to the value of
+ # ${__flags_my_flag_help}, and see if it is non-empty.
_flags_infoVar_="__flags_${_flags_gFI_usName_}_${_flags_gFI_info_}"
_flags_strToEval_="_flags_infoValue_=\"\${${_flags_infoVar_}:-}\""
eval "${_flags_strToEval_}"
if [ -n "${_flags_infoValue_}" ]; then
+ # Special value '§' indicates no help string provided.
+ [ "${_flags_gFI_info_}" = ${__FLAGS_INFO_HELP} \
+ -a "${_flags_infoValue_}" = '§' ] && _flags_infoValue_=''
flags_return=${FLAGS_TRUE}
else
- # see if the _flags_gFI_usName_ variable is a string as strings can be
+ # See if the _flags_gFI_usName_ variable is a string as strings can be
# empty...
- # note: the DRY principle would say to have this function call itself for
+ # Note: the DRY principle would say to have this function call itself for
# the next three lines, but doing so results in an infinite loop as an
# invalid _flags_name_ will also not have the associated _type variable.
# Because it doesn't (it will evaluate to an empty string) the logic will
# try to find the _type variable of the _type variable, and so on. Not so
# good ;-)
+ #
+ # Example cont.: set the _flags_typeValue_ variable to the value of
+ # ${__flags_my_flag_type}, and see if it equals '4'.
_flags_typeVar_="__flags_${_flags_gFI_usName_}_${__FLAGS_INFO_TYPE}"
_flags_strToEval_="_flags_typeValue_=\"\${${_flags_typeVar_}:-}\""
eval "${_flags_strToEval_}"
+ # shellcheck disable=SC2154
if [ "${_flags_typeValue_}" = "${__FLAGS_TYPE_STRING}" ]; then
flags_return=${FLAGS_TRUE}
else
@@ -466,7 +553,7 @@ _flags_getFlagInfo()
return ${flags_return}
}
-# Check for presense of item in a list.
+# Check for presence of item in a list.
#
# Passed a string (e.g. 'abc'), this function will determine if the string is
# present in the list of strings (e.g. ' foo bar abc ').
@@ -480,12 +567,10 @@ _flags_itemInList() {
_flags_str_=$1
shift
- echo " ${*:-} " |grep " ${_flags_str_} " >/dev/null
- if [ $? -eq 0 ]; then
- flags_return=${FLAGS_TRUE}
- else
- flags_return=${FLAGS_FALSE}
- fi
+ case " ${*:-} " in
+ *\ ${_flags_str_}\ *) flags_return=${FLAGS_TRUE} ;;
+ *) flags_return=${FLAGS_FALSE} ;;
+ esac
unset _flags_str_
return ${flags_return}
@@ -495,22 +580,23 @@ _flags_itemInList() {
#
# Output:
# integer: width in columns of the current screen.
-_flags_columns()
-{
+_flags_columns() {
if [ -z "${__flags_columns}" ]; then
- # determine the value and store it
if eval stty size >/dev/null 2>&1; then
# stty size worked :-)
+ # shellcheck disable=SC2046
set -- `stty size`
- __flags_columns=$2
- elif eval tput cols >/dev/null 2>&1; then
+ __flags_columns="${2:-}"
+ fi
+ fi
+ if [ -z "${__flags_columns}" ]; then
+ if eval tput cols >/dev/null 2>&1; then
+ # shellcheck disable=SC2046
set -- `tput cols`
- __flags_columns=$1
- else
- __flags_columns=80 # default terminal width
+ __flags_columns="${1:-}"
fi
fi
- echo ${__flags_columns}
+ echo "${__flags_columns:-80}"
}
# Validate a boolean.
@@ -519,8 +605,7 @@ _flags_columns()
# _flags__bool: boolean: value to validate
# Returns:
# bool: true if the value is a valid boolean
-_flags_validBool()
-{
+_flags_validBool() {
_flags_bool_=$1
flags_return=${FLAGS_TRUE}
@@ -540,31 +625,33 @@ _flags_validBool()
# _flags_float_: float: value to validate
# Returns:
# bool: true if the value is a valid integer
-_flags_validFloat()
-{
+_flags_validFloat() {
flags_return=${FLAGS_FALSE}
- [ -n "$1" ] || return ${flags_return}
+ if [ -z "$1" ]; then
+ return ${flags_return}
+ fi
_flags_float_=$1
- if _flags_validInt ${_flags_float_}; then
+ if _flags_validInt "${_flags_float_}"; then
flags_return=${FLAGS_TRUE}
elif _flags_useBuiltin; then
_flags_float_whole_=${_flags_float_%.*}
_flags_float_fraction_=${_flags_float_#*.}
- if _flags_validInt ${_flags_float_whole_:-0} -a \
- _flags_validInt ${_flags_float_fraction_}; then
+ [ "${_flags_float_whole_}" = '-' ] && _flags_float_whole_='-0'
+ if _flags_validInt "${_flags_float_whole_:-0}" -a \
+ _flags_validInt "${_flags_float_fraction_}"; then
flags_return=${FLAGS_TRUE}
fi
unset _flags_float_whole_ _flags_float_fraction_
else
flags_return=${FLAGS_TRUE}
case ${_flags_float_} in
- -*) # negative floats
- _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\
+ -*) # Negative floats.
+ _flags_test_=`${FLAGS_EXPR_CMD} "${_flags_float_}" :\
'\(-[0-9]*\.[0-9]*\)'`
;;
- *) # positive floats
- _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\
+ *) # Positive floats.
+ _flags_test_=`${FLAGS_EXPR_CMD} "${_flags_float_}" :\
'\([0-9]*\.[0-9]*\)'`
;;
esac
@@ -582,30 +669,8 @@ _flags_validFloat()
# _flags_int_: integer: value to validate
# Returns:
# bool: true if the value is a valid integer
-_flags_validInt()
-{
- flags_return=${FLAGS_FALSE}
- [ -n "$1" ] || return ${flags_return}
- _flags_int_=$1
-
- case ${_flags_int_} in
- -*.*) ;; # ignore negative floats (we'll invalidate them later)
- -*) # strip possible leading negative sign
- if _flags_useBuiltin; then
- _flags_int_=${_flags_int_#-}
- else
- _flags_int_=`${FLAGS_EXPR_CMD} -- "${_flags_int_}" : '-\([0-9][0-9]*\)'`
- fi
- ;;
- esac
-
- case ${_flags_int_} in
- *[!0-9]*) flags_return=${FLAGS_FALSE} ;;
- *) flags_return=${FLAGS_TRUE} ;;
- esac
-
- unset _flags_int_
- return ${flags_return}
+_flags_validInt() {
+ expr \( "$1" + '0' \) '=' "$1" >/dev/null 2>&1
}
# Parse command-line options using the standard getopt.
@@ -617,14 +682,13 @@ _flags_validInt()
# @: varies: command-line options to parse
# Returns:
# integer: a FLAGS success condition
-_flags_getoptStandard()
-{
+_flags_getoptStandard() {
flags_return=${FLAGS_TRUE}
_flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}`
- # check for spaces in passed options
+ # Check for spaces in passed options.
for _flags_opt_ in "$@"; do
- # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
+ # Note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06.
_flags_match_=`echo "x${_flags_opt_}x" |sed 's/ //g'`
if [ "${_flags_match_}" != "x${_flags_opt_}x" ]; then
flags_error='the available getopt does not support spaces in options'
@@ -634,7 +698,7 @@ _flags_getoptStandard()
done
if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then
- __flags_opts=`getopt ${_flags_shortOpts_} $@ 2>&1`
+ __flags_opts=`getopt "${_flags_shortOpts_}" "$@" 2>&1`
_flags_rtrn_=$?
if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then
_flags_warn "${__flags_opts}"
@@ -656,8 +720,7 @@ _flags_getoptStandard()
# @: varies: command-line options to parse
# Returns:
# integer: a FLAGS success condition
-_flags_getoptEnhanced()
-{
+_flags_getoptEnhanced() {
flags_return=${FLAGS_TRUE}
_flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}`
_flags_boolOpts_=`echo "${__flags_boolNames}" \
@@ -665,7 +728,7 @@ _flags_getoptEnhanced()
_flags_longOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_LONG}`
__flags_opts=`${FLAGS_GETOPT_CMD} \
- -o ${_flags_shortOpts_} \
+ -o "${_flags_shortOpts_}" \
-l "${_flags_longOpts_},${_flags_boolOpts_}" \
-- "$@" 2>&1`
_flags_rtrn_=$?
@@ -686,58 +749,48 @@ _flags_getoptEnhanced()
# dynamic to support any number of flags.
#
# Args:
-# argc: int: original command-line argument count
# @: varies: output from getopt parsing
# Returns:
# integer: a FLAGS success condition
-_flags_parseGetopt()
-{
- _flags_argc_=$1
- shift
-
+_flags_parseGetopt() {
flags_return=${FLAGS_TRUE}
- if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then
+ if [ "${__FLAGS_GETOPT_VERS}" -ne "${__FLAGS_GETOPT_VERS_ENH}" ]; then
+ # The @$ must be unquoted as it needs to be re-split.
+ # shellcheck disable=SC2068
set -- $@
else
- # note the quotes around the `$@' -- they are essential!
+ # Note the quotes around the `$@` -- they are essential!
eval set -- "$@"
fi
- # Provide user with the number of arguments to shift by later.
- # NOTE: the FLAGS_ARGC variable is obsolete as of 1.0.3 because it does not
- # properly give user access to non-flag arguments mixed in between flag
- # arguments. Its usage was replaced by FLAGS_ARGV, and it is being kept only
- # for backwards compatibility reasons.
- FLAGS_ARGC=`_flags_math "$# - 1 - ${_flags_argc_}"`
-
- # handle options. note options with values must do an additional shift
+ # Handle options. note options with values must do an additional shift.
while true; do
_flags_opt_=$1
_flags_arg_=${2:-}
_flags_type_=${__FLAGS_TYPE_NONE}
_flags_name_=''
- # determine long flag name
+ # Determine long flag name.
case "${_flags_opt_}" in
- --) shift; break ;; # discontinue option parsing
+ --) shift; break ;; # Discontinue option parsing.
- --*) # long option
+ --*) # Long option.
if _flags_useBuiltin; then
_flags_opt_=${_flags_opt_#*--}
else
- _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '--\(.*\)'`
+ _flags_opt_=`${FLAGS_EXPR_CMD} "${_flags_opt_}" : '--\(.*\)'`
fi
_flags_len_=${__FLAGS_LEN_LONG}
- if _flags_itemInList "${_flags_opt_}" ${__flags_longNames}; then
+ if _flags_itemInList "${_flags_opt_}" "${__flags_longNames}"; then
_flags_name_=${_flags_opt_}
else
- # check for negated long boolean version
- if _flags_itemInList "${_flags_opt_}" ${__flags_boolNames}; then
+ # Check for negated long boolean version.
+ if _flags_itemInList "${_flags_opt_}" "${__flags_boolNames}"; then
if _flags_useBuiltin; then
_flags_name_=${_flags_opt_#*no}
else
- _flags_name_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : 'no\(.*\)'`
+ _flags_name_=`${FLAGS_EXPR_CMD} "${_flags_opt_}" : 'no\(.*\)'`
fi
_flags_type_=${__FLAGS_TYPE_BOOLEAN}
_flags_arg_=${__FLAGS_NULL}
@@ -745,34 +798,34 @@ _flags_parseGetopt()
fi
;;
- -*) # short option
+ -*) # Short option.
if _flags_useBuiltin; then
_flags_opt_=${_flags_opt_#*-}
else
- _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '-\(.*\)'`
+ _flags_opt_=`${FLAGS_EXPR_CMD} "${_flags_opt_}" : '-\(.*\)'`
fi
_flags_len_=${__FLAGS_LEN_SHORT}
- if _flags_itemInList "${_flags_opt_}" ${__flags_shortNames}; then
- # yes. match short name to long name. note purposeful off-by-one
+ if _flags_itemInList "${_flags_opt_}" "${__flags_shortNames}"; then
+ # Yes. Match short name to long name. Note purposeful off-by-one
# (too high) with awk calculations.
_flags_pos_=`echo "${__flags_shortNames}" \
|awk 'BEGIN{RS=" ";rn=0}$0==e{rn=NR}END{print rn}' \
- e=${_flags_opt_}`
+ e="${_flags_opt_}"`
_flags_name_=`echo "${__flags_longNames}" \
|awk 'BEGIN{RS=" "}rn==NR{print $0}' rn="${_flags_pos_}"`
fi
;;
esac
- # die if the flag was unrecognized
+ # Die if the flag was unrecognized.
if [ -z "${_flags_name_}" ]; then
flags_error="unrecognized option (${_flags_opt_})"
flags_return=${FLAGS_ERROR}
break
fi
- # set new flag value
- _flags_usName_=`_flags_underscoreName ${_flags_name_}`
+ # Set new flag value.
+ _flags_usName_=`_flags_underscoreName "${_flags_name_}"`
[ ${_flags_type_} -eq ${__FLAGS_TYPE_NONE} ] && \
_flags_type_=`_flags_getFlagInfo \
"${_flags_usName_}" ${__FLAGS_INFO_TYPE}`
@@ -788,7 +841,8 @@ _flags_parseGetopt()
_flags_strToEval_="_flags_val_=\
\${__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}}"
eval "${_flags_strToEval_}"
- if [ ${_flags_val_} -eq ${FLAGS_FALSE} ]; then
+ # shellcheck disable=SC2154
+ if [ "${_flags_val_}" -eq ${FLAGS_FALSE} ]; then
eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}"
else
eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}"
@@ -821,22 +875,23 @@ _flags_parseGetopt()
;;
esac
- # handle special case help flag
+ # Handle special case help flag.
if [ "${_flags_usName_}" = 'help' ]; then
- if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then
+ # shellcheck disable=SC2154
+ if [ "${FLAGS_help}" -eq ${FLAGS_TRUE} ]; then
flags_help
flags_error='help requested'
- flags_return=${FLAGS_TRUE}
+ flags_return=${FLAGS_FALSE}
break
fi
fi
- # shift the option and non-boolean arguements out.
+ # Shift the option and non-boolean arguments out.
shift
- [ ${_flags_type_} != ${__FLAGS_TYPE_BOOLEAN} ] && shift
+ [ "${_flags_type_}" != ${__FLAGS_TYPE_BOOLEAN} ] && shift
done
- # give user back non-flag arguments
+ # Give user back non-flag arguments.
FLAGS_ARGV=''
while [ $# -gt 0 ]; do
FLAGS_ARGV="${FLAGS_ARGV:+${FLAGS_ARGV} }'$1'"
@@ -856,19 +911,19 @@ _flags_parseGetopt()
# integer: the result
# Returns:
# bool: success of math evaluation
-_flags_math()
-{
+_flags_math() {
if [ $# -eq 0 ]; then
flags_return=${FLAGS_FALSE}
elif _flags_useBuiltin; then
# Variable assignment is needed as workaround for Solaris Bourne shell,
# which cannot parse a bare $((expression)).
+ # shellcheck disable=SC2016
_flags_expr_='$(($@))'
eval echo ${_flags_expr_}
flags_return=$?
unset _flags_expr_
else
- eval expr $@
+ eval expr "$@"
flags_return=$?
fi
@@ -883,8 +938,7 @@ _flags_math()
# integer: length of string
# Returns:
# bool: success of strlen evaluation
-_flags_strlen()
-{
+_flags_strlen() {
_flags_str_=${1:-}
if [ -z "${_flags_str_}" ]; then
@@ -892,12 +946,12 @@ _flags_strlen()
elif _flags_useBuiltin; then
flags_output=${#_flags_str_}
else
- flags_output=`${FLAGS_EXPR_CMD} -- "${_flags_str_}" : '.*'`
+ flags_output=`${FLAGS_EXPR_CMD} "${_flags_str_}" : '.*'`
fi
flags_return=$?
unset _flags_str_
- echo ${flags_output}
+ echo "${flags_output}"
return ${flags_return}
}
@@ -907,18 +961,15 @@ _flags_strlen()
# None
# Returns:
# bool: true if built-ins should be used
-_flags_useBuiltin()
-{
- return ${__FLAGS_USE_BUILTIN}
-}
+_flags_useBuiltin() { return ${__FLAGS_USE_BUILTIN}; }
#------------------------------------------------------------------------------
# public functions
-#
+#
# A basic boolean flag. Boolean flags do not take any arguments, and their
# value is either 1 (false) or 0 (true). For long flags, the false value is
# specified on the command line by prepending the word 'no'. With short flags,
-# the presense of the flag toggles the current value between true and false.
+# the presence of the flag toggles the current value between true and false.
# Specifying a short boolean flag twice on the command results in returning the
# value back to the default value.
#
@@ -941,32 +992,34 @@ DEFINE_string() { _flags_define ${__FLAGS_TYPE_STRING} "$@"; }
# unnamed: list: command-line flags to parse
# Returns:
# integer: success of operation, or error
-FLAGS()
-{
- # define a standard 'help' flag if one isn't already defined
- [ -z "${__flags_help_type:-}" ] && \
- DEFINE_boolean 'help' false 'show this help' 'h'
+FLAGS() {
+ # Define a standard 'help' flag if one isn't already defined.
+ if [ -z "${__flags_help_type:-}" ]; then
+ DEFINE_boolean 'help' false 'show this help' 'h'
+ fi
- # parse options
+ # Parse options.
if [ $# -gt 0 ]; then
- if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then
+ if [ "${__FLAGS_GETOPT_VERS}" -ne "${__FLAGS_GETOPT_VERS_ENH}" ]; then
_flags_getoptStandard "$@"
else
_flags_getoptEnhanced "$@"
fi
flags_return=$?
else
- # nothing passed; won't bother running getopt
+ # Nothing passed; won't bother running getopt.
__flags_opts='--'
flags_return=${FLAGS_TRUE}
fi
if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then
- _flags_parseGetopt $# "${__flags_opts}"
+ _flags_parseGetopt "${__flags_opts}"
flags_return=$?
fi
- [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_fatal "${flags_error}"
+ if [ ${flags_return} -eq ${FLAGS_ERROR} ]; then
+ _flags_fatal "${flags_error}"
+ fi
return ${flags_return}
}
@@ -980,13 +1033,12 @@ FLAGS()
# debug info that can be included in a bug report
# Returns:
# nothing
-flags_getoptInfo()
-{
- # platform info
+flags_getoptInfo() {
+ # Platform info.
_flags_debug "uname -a: `uname -a`"
_flags_debug "PATH: ${PATH}"
- # shell info
+ # Shell info.
if [ -n "${BASH_VERSION:-}" ]; then
_flags_debug 'shell: bash'
_flags_debug "BASH_VERSION: ${BASH_VERSION}"
@@ -995,7 +1047,7 @@ flags_getoptInfo()
_flags_debug "ZSH_VERSION: ${ZSH_VERSION}"
fi
- # getopt info
+ # getopt info.
${FLAGS_GETOPT_CMD} >/dev/null
_flags_getoptReturn=$?
_flags_debug "getopt return: ${_flags_getoptReturn}"
@@ -1012,9 +1064,8 @@ flags_getoptInfo()
# none
# Returns:
# bool: true if getopt is the enhanced version
-flags_getoptIsEnh()
-{
- test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH}
+flags_getoptIsEnh() {
+ test "${__FLAGS_GETOPT_VERS}" -eq "${__FLAGS_GETOPT_VERS_ENH}"
}
# Returns whether the detected getopt version is the standard version.
@@ -1023,9 +1074,8 @@ flags_getoptIsEnh()
# none
# Returns:
# bool: true if getopt is the standard version
-flags_getoptIsStd()
-{
- test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD}
+flags_getoptIsStd() {
+ test "${__FLAGS_GETOPT_VERS}" -eq "${__FLAGS_GETOPT_VERS_STD}"
}
# This is effectively a 'usage()' function. It prints usage information and
@@ -1037,8 +1087,7 @@ flags_getoptIsStd()
# none
# Returns:
# integer: success of operation (always returns true)
-flags_help()
-{
+flags_help() {
if [ -n "${FLAGS_HELP:-}" ]; then
echo "${FLAGS_HELP}" >&2
else
@@ -1049,7 +1098,7 @@ flags_help()
for flags_name_ in ${__flags_longNames}; do
flags_flagStr_=''
flags_boolStr_=''
- flags_usName_=`_flags_underscoreName ${flags_name_}`
+ flags_usName_=`_flags_underscoreName "${flags_name_}"`
flags_default_=`_flags_getFlagInfo \
"${flags_usName_}" ${__FLAGS_INFO_DEFAULT}`
@@ -1063,11 +1112,11 @@ flags_help()
[ "${flags_short_}" != "${__FLAGS_NULL}" ] && \
flags_flagStr_="-${flags_short_}"
- if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} ]; then
+ if [ "${__FLAGS_GETOPT_VERS}" -eq "${__FLAGS_GETOPT_VERS_ENH}" ]; then
[ "${flags_short_}" != "${__FLAGS_NULL}" ] && \
flags_flagStr_="${flags_flagStr_},"
- # add [no] to long boolean flag names, except the 'help' flag
- [ ${flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} \
+ # Add [no] to long boolean flag names, except the 'help' flag.
+ [ "${flags_type_}" -eq ${__FLAGS_TYPE_BOOLEAN} \
-a "${flags_usName_}" != 'help' ] && \
flags_boolStr_='[no]'
flags_flagStr_="${flags_flagStr_}--${flags_boolStr_}${flags_name_}:"
@@ -1075,7 +1124,7 @@ flags_help()
case ${flags_type_} in
${__FLAGS_TYPE_BOOLEAN})
- if [ ${flags_default_} -eq ${FLAGS_TRUE} ]; then
+ if [ "${flags_default_}" -eq ${FLAGS_TRUE} ]; then
flags_defaultStr_='true'
else
flags_defaultStr_='false'
@@ -1087,16 +1136,16 @@ flags_help()
esac
flags_defaultStr_="(default: ${flags_defaultStr_})"
- flags_helpStr_=" ${flags_flagStr_} ${flags_help_} ${flags_defaultStr_}"
+ flags_helpStr_=" ${flags_flagStr_} ${flags_help_:+${flags_help_} }${flags_defaultStr_}"
_flags_strlen "${flags_helpStr_}" >/dev/null
flags_helpStrLen_=${flags_output}
flags_columns_=`_flags_columns`
- if [ ${flags_helpStrLen_} -lt ${flags_columns_} ]; then
+ if [ "${flags_helpStrLen_}" -lt "${flags_columns_}" ]; then
echo "${flags_helpStr_}" >&2
else
echo " ${flags_flagStr_} ${flags_help_}" >&2
- # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
+ # Note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
# because it doesn't like empty strings when used in this manner.
flags_emptyStr_="`echo \"x${flags_flagStr_}x\" \
|awk '{printf "%"length($0)-2"s", ""}'`"
@@ -1104,13 +1153,13 @@ flags_help()
_flags_strlen "${flags_helpStr_}" >/dev/null
flags_helpStrLen_=${flags_output}
- if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} \
- -o ${flags_helpStrLen_} -lt ${flags_columns_} ]; then
- # indented to match help string
+ if [ "${__FLAGS_GETOPT_VERS}" -eq "${__FLAGS_GETOPT_VERS_STD}" \
+ -o "${flags_helpStrLen_}" -lt "${flags_columns_}" ]; then
+ # Indented to match help string.
echo "${flags_helpStr_}" >&2
else
- # indented four from left to allow for longer defaults as long flag
- # names might be used too, making things too long
+ # Indented four from left to allow for longer defaults as long flag
+ # names might be used too, making things too long.
echo " ${flags_defaultStr_}" >&2
fi
fi
@@ -1129,10 +1178,9 @@ flags_help()
# none
# Returns:
# nothing
-flags_reset()
-{
+flags_reset() {
for flags_name_ in ${__flags_longNames}; do
- flags_usName_=`_flags_underscoreName ${flags_name_}`
+ flags_usName_=`_flags_underscoreName "${flags_name_}"`
flags_strToEval_="unset FLAGS_${flags_usName_}"
for flags_type_ in \
${__FLAGS_INFO_DEFAULT} \
@@ -1143,14 +1191,24 @@ flags_reset()
flags_strToEval_=\
"${flags_strToEval_} __flags_${flags_usName_}_${flags_type_}"
done
- eval ${flags_strToEval_}
+ eval "${flags_strToEval_}"
done
- # reset internal variables
+ # Reset internal variables.
__flags_boolNames=' '
__flags_longNames=' '
__flags_shortNames=' '
__flags_definedNames=' '
+ # Reset logging level back to default.
+ flags_setLoggingLevel ${__FLAGS_LEVEL_DEFAULT}
+
unset flags_name_ flags_type_ flags_strToEval_ flags_usName_
}
+
+#-----------------------------------------------------------------------------
+# Initialization
+#
+
+# Set the default logging level.
+flags_setLoggingLevel ${__FLAGS_LEVEL_DEFAULT}
diff --git a/shflags_defines_test.sh b/shflags_defines_test.sh
new file mode 100755
index 0000000..7f5baf7
--- /dev/null
+++ b/shflags_defines_test.sh
@@ -0,0 +1,218 @@
+#! /bin/sh
+# vim:et:ft=sh:sts=2:sw=2
+#
+# shFlags unit test for the flag definition methods
+#
+# Copyright 2008-2020 Kate Ward. All Rights Reserved.
+# Released under the Apache 2.0 license.
+#
+# Author: kate.ward@forestent.com (Kate Ward)
+# https://github.com/kward/shflags
+#
+### ShellCheck (http://www.shellcheck.net/)
+# Disable source following.
+# shellcheck disable=SC1090,SC1091
+
+# Exit immediately if a simple command exits with a non-zero status.
+set -e
+
+# Treat unset variables as an error when performing parameter expansion.
+set -u
+
+# These variables will be overridden by the test helpers.
+stdoutF="${TMPDIR:-/tmp}/STDOUT"
+stderrF="${TMPDIR:-/tmp}/STDERR"
+
+# Load test helpers.
+. ./shflags_test_helpers
+
+testFlagsDefine() {
+ # No arguments.
+ if _flags_define >"${stdoutF}" 2>"${stderrF}"
+ then :; else
+ assertEquals '_flags_define() with no arguments should error' "${FLAGS_ERROR}" $?
+ fi
+ assertErrorMsg '' 'no arguments'
+
+ # One argument.
+ if _flags_define arg1 >"${stdoutF}" 2>"${stderrF}"
+ then :; else
+ assertEquals '_flags_define() call with one argument should error' "${FLAGS_ERROR}" $?
+ fi
+ assertErrorMsg '' 'one argument'
+
+ # Two arguments.
+ if _flags_define arg1 arg2 >"${stdoutF}" 2>"${stderrF}"
+ then :; else
+ assertEquals '_flags_define() call with two arguments should error' "${FLAGS_ERROR}" $?
+ fi
+ assertErrorMsg '' 'two arguments'
+
+ # Three arguments.
+ if _flags_define arg1 arg2 arg3 >"${stdoutF}" 2>"${stderrF}"
+ then :; else
+ assertEquals '_flags_define() call with three arguments should error' "${FLAGS_ERROR}" $?
+ fi
+ assertErrorMsg '' 'three arguments'
+
+ # Multiple definition. Assumes working boolean definition (tested elsewhere).
+ if ! _flags_define "${__FLAGS_TYPE_BOOLEAN}" multiDefBool true 'multi def #1' m; then
+ fail "didn't expect _flags_define for 'multi def #1' to fail"
+ fi
+ if _flags_define "${__FLAGS_TYPE_BOOLEAN}" multiDefBool false 'multi def #2' m >"${stdoutF}" 2>"${stderrF}"
+ then :; else
+ assertEquals '_flags_define() with existing flag name should fail' "${FLAGS_FALSE}" $?
+ fi
+ assertTrue '_flags_define() should not overwrite previously defined default.' "${FLAGS_multiDefBool:-}"
+ assertWarnMsg '' 'existing flag'
+
+ # Duplicate dashed and underscored definition.
+ if ! _flags_define "${__FLAGS_TYPE_STRING}" long-name 'foo' 'dashed name' l; then
+ fail "didn't expect _flags_define() for 'dashed name' to fail"
+ fi
+ if _flags_define "${__FLAGS_TYPE_STRING}" long_name 'bar' 'underscored name' l >"${stdoutF}" 2>"${stderrF}"
+ then :; else
+ assertEquals '_flags_define() with duplicate dashed and underscored definition should fail' "${FLAGS_FALSE}" $?
+ fi
+ # shellcheck disable=SC2154
+ assertEquals '_flags_define() should not overwrite previously defined default.' "${FLAGS_long_name}" 'foo'
+ assertWarnMsg '' 'already exists'
+
+ # TODO(kward): test requirement of enhanced getopt.
+
+ # Invalid type.
+ if _flags_define invalid arg2 arg3 arg4 i >"${stdoutF}" 2>"${stderrF}"
+ then :; else
+ assertEquals '_flags_define() with "invalid" type should have failed.' "${FLAGS_ERROR}" $?
+ fi
+ assertErrorMsg 'unrecognized flag type' 'invalid type'
+}
+
+testBoolean() {
+ while read -r desc ok default want; do
+ flags_reset
+
+ if DEFINE_boolean boolVal "${default}" 'my boolean' b >"${stdoutF}" 2>"${stderrF}"
+ then
+ assertEquals "${desc}: incorrect FLAGS_boolVal value" "${FLAGS_boolVal:-}" "${want}"
+ else
+ got=$?
+ if [ "${ok}" -eq "${FLAGS_TRUE}" ]; then
+ assertEquals "${desc}: DEFINE_boolean() failed unexpectedly" "${want}" "${got}"
+ else
+ assertEquals "${desc}: DEFINE_boolean() expected different return value" "${want}" "${got}"
+ assertErrorMsg
+ fi
+ fi
+ done <<EOF
+true_long ${FLAGS_TRUE} true ${FLAGS_TRUE}
+true_short ${FLAGS_TRUE} t ${FLAGS_TRUE}
+true_int ${FLAGS_TRUE} 0 ${FLAGS_TRUE}
+false_long ${FLAGS_TRUE} false ${FLAGS_FALSE}
+false_short ${FLAGS_TRUE} f ${FLAGS_FALSE}
+false_int ${FLAGS_TRUE} 1 ${FLAGS_FALSE}
+invalid ${FLAGS_FALSE} invalid ${FLAGS_ERROR}
+EOF
+}
+
+testFloat() {
+ # Valid defaults.
+ for default in ${TH_FLOAT_VALID}; do
+ flags_reset
+ desc="valid_float_val='${default}'"
+ if DEFINE_float floatVal "${default}" 'valid float' f
+ then
+ got="${FLAGS_floatVal:-}" want="${default}"
+ assertEquals "${desc}: incorrect FLAGS_floatVal value" "${want}" "${got}"
+ else
+ assertEquals "${desc}: DEFINE_float() failed unexpectedly." "${FLAGS_TRUE}" $?
+ fi
+ done
+
+ # Invalid defaults.
+ for default in ${TH_FLOAT_INVALID}; do
+ flags_reset
+ desc="invalid_float_val='${default}'"
+ if DEFINE_float floatVal "${default}" 'invalid float' f >"${stdoutF}" 2>"${stderrF}"
+ then
+ fail "${desc}: expected DEFINE_float() to fail"
+ else
+ assertEquals "${desc}: DEFINE_float() expected error" "${FLAGS_ERROR}" $?
+ assertErrorMsg
+ fi
+ done
+}
+
+testInteger() {
+ # Valid defaults.
+ for default in ${TH_INT_VALID}; do
+ flags_reset
+ desc="valid_int_val='${default}'"
+ if DEFINE_integer intVal "${default}" 'valid integer' i
+ then
+ got="${FLAGS_intVal:-}" want="${default}"
+ assertEquals "${desc}: incorrect FLAGS_intVal value" "${want}" "${got}"
+ else
+ assertEquals "${desc}: DEFINE_integer() failed unexpectedly." "${FLAGS_TRUE}" $?
+ fi
+ done
+
+ # Invalid defaults.
+ for default in ${TH_INT_INVALID}; do
+ flags_reset
+ desc="invalid_int_val='${default}'"
+ if DEFINE_integer intVal "${default}" 'invalid integer' i >"${stdoutF}" 2>"${stderrF}"
+ then
+ fail "${desc}: expected DEFINE_integer() to fail"
+ else
+ assertEquals "${desc}: DEFINE_integer() expected error." "${FLAGS_ERROR}" $?
+ assertErrorMsg
+ fi
+ done
+}
+
+testString() {
+ # Valid defaults.
+ for default in ${TH_BOOL_VALID} ${TH_FLOAT_VALID} ${TH_INT_VALID} 'also valid' ''
+ do
+ flags_reset
+ desc="valid_string_val='${default}'"
+ if DEFINE_string strVal "${default}" "string: ${default}" s
+ then
+ got="${FLAGS_strVal:-}" want="${default}"
+ assertEquals "${desc}: incorrect FLAGS_strVal value" "${want}" "${got}"
+ else
+ assertEquals "${desc}: DEFINE_string() failed unexpectedly." "${FLAGS_TRUE}" $?
+ fi
+ done
+
+ # There are no known invalid defaults.
+}
+
+testShortNameLength() {
+ # Make sure short names are no longer than a single character.
+ :
+}
+
+testFlagNameIsReserved() {
+ if DEFINE_string TRUE '' 'true is a reserved flag name' t >"${stdoutF}" 2>"${stderrF}"
+ then
+ fail "expected DEFINE with reserved flag name to fail"
+ else
+ assertEquals "expected error from DEFINE with reserved flag" "${FLAGS_ERROR}" $?
+ assertErrorMsg 'flag name (TRUE) is reserved'
+ fi
+}
+
+oneTimeSetUp() {
+ th_oneTimeSetUp
+}
+
+tearDown() {
+ flags_reset
+}
+
+# Load and run shUnit2.
+# shellcheck disable=SC2034
+[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
+. "${TH_SHUNIT}"
diff --git a/shflags_parsing_test.sh b/shflags_parsing_test.sh
new file mode 100755
index 0000000..606d757
--- /dev/null
+++ b/shflags_parsing_test.sh
@@ -0,0 +1,333 @@
+#! /bin/sh
+# vim:et:ft=sh:sts=2:sw=2
+#
+# shFlags unit test for the flag definition methods
+#
+# Copyright 2008-2020 Kate Ward. All Rights Reserved.
+# Released under the Apache 2.0 license.
+#
+# Author: kate.ward@forestent.com (Kate Ward)
+# https://github.com/kward/shflags
+#
+### ShellCheck (http://www.shellcheck.net/)
+# Disable source following.
+# shellcheck disable=SC1090,SC1091
+
+# TODO(kward): assert on FLAGS errors
+# TODO(kward): testNonStandardIFS()
+
+# These variables will be overridden by the test helpers.
+stdoutF="${TMPDIR:-/tmp}/STDOUT"
+stderrF="${TMPDIR:-/tmp}/STDERR"
+
+# Load test helpers.
+. ./shflags_test_helpers
+
+testGetoptStandard() {
+ if ! _flags_getoptStandard '-b' >"${stdoutF}" 2>"${stderrF}"; then
+ fail "error parsing -b flag"
+ _showTestOutput
+ fi
+
+ if _flags_getoptStandard '-x' >"${stdoutF}" 2>"${stderrF}"; then
+ fail "expected error parsing invalid -x flag"
+ _showTestOutput
+ fi
+}
+
+testGetoptEnhanced() {
+ if ! flags_getoptIsEnh; then
+ return
+ fi
+
+ if ! _flags_getoptEnhanced '-b' >"${stdoutF}" 2>"${stderrF}"; then
+ fail "error parsing -b flag"
+ _showTestOutput
+ fi
+ if ! _flags_getoptEnhanced '--bool' >"${stdoutF}" 2>"${stderrF}"; then
+ fail "error parsing --bool flag"
+ _showTestOutput
+ fi
+
+ if _flags_getoptEnhanced '-x' >"${stdoutF}" 2>"${stderrF}"; then
+ fail "expected error parsing invalid -x flag"
+ _showTestOutput
+ fi
+ if _flags_getoptEnhanced '--xyz' >"${stdoutF}" 2>"${stderrF}"; then
+ fail "expected error parsing invalid --xyz flag"
+ _showTestOutput
+ fi
+}
+
+testValidBoolsShort() {
+ desc='bool_true_arg'
+ if FLAGS -b >"${stdoutF}" 2>"${stderrF}"; then
+ assertTrue "${desc}: expected true value" "${FLAGS_bool:-}"
+ else
+ fail "${desc}: FLAGS returned a non-zero result ($?)"
+ fi
+ th_showOutput
+
+ desc='bool2_defined'
+ DEFINE_boolean bool2 true '2nd boolean' B
+ if FLAGS >"${stdoutF}" 2>"${stderrF}"; then
+ assertTrue "${desc}: expected true value" "${FLAGS_bool2:-}"
+ else
+ fail "${desc}: FLAGS returned a non-zero result ($?)"
+ fi
+ th_showOutput
+
+ desc='bool_false_arg'
+ if FLAGS -B >"${stdoutF}" 2>"${stderrF}"; then
+ assertFalse "${desc}: expected false value" "${FLAGS_bool2:-}"
+ else
+ fail "${desc}: FLAGS returned a non-zero result ($?)"
+ fi
+ th_showOutput
+}
+
+# TODO(kate): separate into multiple functions to reflect correct usage
+testValidBoolsLong() {
+ flags_getoptIsEnh
+ [ $? -eq "${FLAGS_FALSE}" ] && return
+
+ # Note: the default value of bool is 'false'.
+
+ # Leave flag false.
+ FLAGS --nobool >"${stdoutF}" 2>"${stderrF}"
+ r3turn=$?
+ assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn}
+ assertFalse '--noXX flag resulted in true value.' "${FLAGS_bool:-}"
+ assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
+ th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
+
+ # Flip flag true.
+ FLAGS --bool >"${stdoutF}" 2>"${stderrF}"
+ r3turn=$?
+ assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn}
+ assertTrue '--XX flag resulted in false value.' "${FLAGS_bool:-}"
+ assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
+ th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
+
+ # Flip flag back false.
+ FLAGS --nobool >"${stdoutF}" 2>"${stderrF}"
+ r3turn=$?
+ assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn}
+ assertFalse '--noXX flag resulted in true value.' "${FLAGS_bool:-}"
+ assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
+ th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
+}
+
+testFloats() {
+ _testFloats '-f'
+ if flags_getoptIsEnh; then
+ _testFloats '--float'
+ fi
+}
+
+_testFloats() {
+ flag=$1
+
+ for value in ${TH_FLOAT_VALID}; do
+ if FLAGS "${flag}" "${value}" >"${stdoutF}" 2>"${stderrF}"; then
+ # shellcheck disable=SC2154
+ assertEquals "${flag}: incorrect value" "${value}" "${FLAGS_float}"
+ else
+ fail "${flag}: unexpected non-zero result ($?)"
+ th_showOutput
+ fi
+ done
+
+ for value in ${TH_FLOAT_INVALID}; do
+ # Wrap FLAGS in () to catch errors.
+ if (FLAGS "${flag}" "${value}" >"${stdoutF}" 2>"${stderrF}"); then
+ fail "${flag}: expected a non-zero result"
+ th_showOutput
+ else
+ assertEquals "${flag}: expected an error" $? "${FLAGS_ERROR}"
+ fi
+ done
+}
+
+testIntegers() {
+ _testIntegers '-i'
+ if flags_getoptIsEnh; then
+ _testIntegers '--int'
+ fi
+}
+
+_testIntegers() {
+ flag=$1
+
+ for value in ${TH_INT_VALID}; do
+ if FLAGS "${flag}" "${value}" >"${stdoutF}" 2>"${stderrF}"; then
+ # shellcheck disable=SC2154
+ assertEquals "${flag}: incorrect value" "${value}" "${FLAGS_int}"
+ else
+ fail "${flag}: unexpected non-zero result ($?)"
+ th_showOutput
+ fi
+ done
+
+ for value in ${TH_INT_INVALID}; do
+ # Wrap FLAGS in () to catch errors.
+ if (FLAGS "${flag}" "${value}" >"${stdoutF}" 2>"${stderrF}"); then
+ fail "${flag}: expected a non-zero result"
+ th_showOutput
+ else
+ assertEquals "${flag}: expected an error" $? "${FLAGS_ERROR}"
+ fi
+ done
+}
+
+testStrings() {
+ _testStrings 'std_single_word' -s single_word
+ if flags_getoptIsEnh; then
+ _testStrings 'enh_single_word' --str single_word
+ _testStrings 'enh_multi_word' --str 'string with spaces'
+ fi
+}
+
+_testStrings() {
+ desc=$1
+ flag=$2
+ value=$3
+
+ if FLAGS "${flag}" "${value}" >"${stdoutF}" 2>"${stderrF}"; then
+ # shellcheck disable=SC2154
+ assertEquals "${desc}: incorrect value" "${value}" "${FLAGS_str}"
+ else
+ fail "${desc}: unexpected non-zero result ($?)"
+ # Validate that an error is thrown for unsupported getopt uses.
+ assertFatalMsg '.* spaces in options'
+ th_showOutput
+ fi
+}
+
+testMultipleFlags() {
+ _testMultipleFlags '-b' '-i' '-f' '-s'
+ flags_getoptIsEnh
+ [ $? -eq "${FLAGS_FALSE}" ] && return
+ _testMultipleFlags '--bool' '--int' '--float' '--str'
+}
+
+_testMultipleFlags() {
+ boolFlag=$1
+ intFlag=$2
+ floatFlag=$3
+ strFlag=$4
+
+ FLAGS \
+ "${boolFlag}" \
+ "${intFlag}" 567 \
+ "${floatFlag}" 123.45678 \
+ "${strFlag}" 'some_string' \
+ >"${stdoutF}" 2>"${stderrF}"
+ r3turn=$?
+ assertTrue "use of multiple flags returned a non-zero result" ${r3turn}
+ assertTrue 'boolean test failed.' "${FLAGS_bool}"
+ assertNotSame 'float test failed.' 0 "${FLAGS_float}"
+ assertNotSame 'integer test failed.' 0 "${FLAGS_int}"
+ assertNotSame 'string test failed.' '' "${FLAGS_str}"
+ assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
+ th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
+}
+
+_testNonFlagArgs() {
+ argc=$1
+ shift
+
+ FLAGS "$@" >"${stdoutF}" 2>"${stderrF}"
+ r3turn=$?
+ assertTrue 'parse returned non-zero value.' ${r3turn}
+ th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
+
+ eval set -- "${FLAGS_ARGV}"
+ assertEquals 'wrong count of argv arguments returned.' "${argc}" $#
+}
+
+testSingleNonFlagArg() { _testNonFlagArgs 1 argOne; }
+testMultipleNonFlagArgs() { _testNonFlagArgs 3 argOne argTwo arg3; }
+
+testMultipleNonFlagStringArgsWithSpaces() {
+ if flags_getoptIsEnh; then
+ _testNonFlagArgs 3 argOne 'arg two' arg3
+ fi
+}
+
+testFlagsWithEquals() {
+ if ! flags_getoptIsEnh; then
+ return
+ fi
+
+ FLAGS --str='str_flag' 'non_flag' >"${stdoutF}" 2>"${stderrF}"
+ assertTrue 'FLAGS returned a non-zero result' $?
+ assertEquals 'string flag not set properly' 'str_flag' "${FLAGS_str}"
+ th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
+
+ eval set -- "${FLAGS_ARGV}"
+ assertEquals 'wrong count of argv arguments returned.' 1 $#
+}
+
+testComplicatedCommandLineStandard() {
+ flags_getoptIsEnh
+ [ $? -eq "${FLAGS_TRUE}" ] && return
+
+ # Note: standard getopt stops parsing after first non-flag argument, which
+ # results in the remaining flags being treated as arguments instead.
+ FLAGS -i 1 non_flag_1 -s 'two' non_flag_2 -f 3 non_flag_3 \
+ >"${stdoutF}" 2>"${stderrF}"
+ r3turn=$?
+ assertTrue 'FLAGS returned a non-zero result' ${r3turn}
+ assertEquals 'failed int test' 1 "${FLAGS_int}"
+ th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
+
+ eval set -- "${FLAGS_ARGV}"
+ assertEquals 'incorrect number of argv values' 7 $#
+}
+
+testComplicatedCommandLineEnhanced() {
+ flags_getoptIsEnh
+ [ $? -eq "${FLAGS_FALSE}" ] && return
+
+ FLAGS -i 1 non_flag_1 --str='two' non_flag_2 --float 3 'non flag 3' \
+ >"${stdoutF}" 2>"${stderrF}"
+ r3turn=$?
+ assertTrue 'FLAGS returned a non-zero result' ${r3turn}
+ assertEquals 'failed int test' 1 "${FLAGS_int}"
+ assertEquals 'failed str test' 'two' "${FLAGS_str}"
+ assertEquals 'failed float test' 3 "${FLAGS_float}"
+ th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
+
+ eval set -- "${FLAGS_ARGV}"
+ assertEquals 'incorrect number of argv values' 3 $#
+}
+
+oneTimeSetUp() {
+ th_oneTimeSetUp
+
+ if flags_getoptIsStd; then
+ th_warn 'Standard version of getopt found. Enhanced tests will be skipped.'
+ else
+ th_warn 'Enhanced version of getopt found. Standard tests will be skipped.'
+ fi
+}
+
+setUp() {
+ DEFINE_boolean bool false 'boolean test' 'b'
+ DEFINE_float float 0.0 'float test' 'f'
+ DEFINE_integer int 0 'integer test' 'i'
+ DEFINE_string str '' 'string test' 's'
+}
+
+tearDown() {
+ flags_reset
+}
+
+# showTestOutput for the most recently run test.
+_showTestOutput() { th_showOutput "${SHUNIT_FALSE}" "${stdoutF}" "${stderrF}"; }
+
+# Load and run shUnit2.
+# shellcheck disable=SC2034
+[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
+. "${TH_SHUNIT}"
diff --git a/shflags_private_test.sh b/shflags_private_test.sh
new file mode 100755
index 0000000..86e4fdd
--- /dev/null
+++ b/shflags_private_test.sh
@@ -0,0 +1,317 @@
+#! /bin/sh
+# vim:et:ft=sh:sts=2:sw=2
+#
+# shFlags unit tests for the internal functions.
+#
+# Copyright 2008-2020 Kate Ward. All Rights Reserved.
+# Released under the Apache 2.0 license.
+#
+# Author: kate.ward@forestent.com (Kate Ward)
+# https://github.com/kward/shflags
+#
+### ShellCheck (http://www.shellcheck.net/)
+# Disable source following.
+# shellcheck disable=SC1090,SC1091
+# expr may be antiquated, but it is the only solution in some cases.
+# shellcheck disable=SC2003
+# $() are not fully portable (POSIX != portable).
+# shellcheck disable=SC2006
+
+# These variables will be overridden by the test helpers.
+stdoutF="${TMPDIR:-/tmp}/STDOUT"
+stderrF="${TMPDIR:-/tmp}/STDERR"
+
+# Load test helpers.
+. ./shflags_test_helpers
+
+testColumns() {
+ cols=`_flags_columns`
+ value=`expr "${cols}" : '\([0-9]*\)'`
+ assertNotNull "unexpected screen width (${cols})" "${value}"
+}
+
+testGetoptVers() {
+ # shellcheck disable=SC2162
+ while read desc mock want; do
+ assertEquals "${desc}" "$(_flags_getopt_vers "${mock}")" "${want}"
+ done <<EOF
+standard mock_getopt_std ${__FLAGS_GETOPT_VERS_STD}
+enhanced mock_getopt_enh ${__FLAGS_GETOPT_VERS_ENH}
+EOF
+}
+
+### The mock_getopt_* commands behave like "getopt -lfoo '' --foo" was called.
+# macOS 10.13.0.
+mock_getopt_std() { echo ' -- --foo'; return 0; }
+# Ubuntu 16.04.3
+mock_getopt_enh() { echo ' --foo --'; return 0; }
+
+testGenOptStr() {
+ _testGenOptStr '' ''
+
+ # shellcheck disable=SC2034
+ DEFINE_boolean bool false 'boolean value' b
+ _testGenOptStr 'b' 'bool'
+
+ # shellcheck disable=SC2034
+ DEFINE_float float 0.0 'float value' f
+ _testGenOptStr 'bf:' 'bool,float:'
+
+ # shellcheck disable=SC2034
+ DEFINE_integer int 0 'integer value' i
+ _testGenOptStr 'bf:i:' 'bool,float:,int:'
+
+ # shellcheck disable=SC2034
+ DEFINE_string str 0 'string value' s
+ _testGenOptStr 'bf:i:s:' 'bool,float:,int:,str:'
+
+ # shellcheck disable=SC2034
+ DEFINE_boolean help false 'show help' h
+ _testGenOptStr 'bf:i:s:h' 'bool,float:,int:,str:,help'
+}
+
+_testGenOptStr() {
+ short=$1
+ long=$2
+
+ result=`_flags_genOptStr "${__FLAGS_OPTSTR_SHORT}"`
+ assertTrue 'short option string generation failed' $?
+ assertEquals "${short}" "${result}"
+
+ result=`_flags_genOptStr "${__FLAGS_OPTSTR_LONG}"`
+ assertTrue 'long option string generation failed' $?
+ assertEquals "${long}" "${result}"
+}
+
+testGetFlagInfo() {
+ __flags_blah_foobar='1234'
+
+ desc='valid_flag'
+ if rslt="`_flags_getFlagInfo 'blah' 'foobar'`"; then
+ assertEquals "${desc}: invalid flag result" "${__flags_blah_foobar}" "${rslt}"
+ else
+ fail "${desc}: request for valid flag info failed"
+ fi
+
+ desc='invalid_flag'
+ if rslt="`_flags_getFlagInfo 'blah' 'hubbabubba' >"${stdoutF}" 2>"${stderrF}"`"; then
+ fail "${desc}: expected invalid flag request to fail"
+ th_showOutput
+ else
+ assertEquals "${desc}: expected an error" "${FLAGS_ERROR}" $?
+ assertErrorMsg "missing flag info variable"
+ fi
+}
+
+testItemInList() {
+ list='this is a test'
+ # shellcheck disable=SC2162
+ while read desc item want; do
+ if [ "${want}" -eq "${FLAGS_TRUE}" ]; then
+ continue
+ fi
+ got=${FLAGS_TRUE}
+ if ! _flags_itemInList "${item}" "${list}"; then
+ got=${FLAGS_FALSE}
+ fi
+ assertEquals "${desc}: itemInList(${item})" "${want}" "${got}"
+ done <<EOF
+lead_item this ${FLAGS_TRUE}
+middle_item is ${FLAGS_TRUE}
+last_item test ${FLAGS_TRUE}
+missing_item asdf ${FLAGS_FALSE}
+test_partial_te te ${FLAGS_FALSE}
+test_partial_es es ${FLAGS_FALSE}
+test_partial_st st ${FLAGS_FALSE}
+empty_item '' ${FLAGS_FALSE}
+EOF
+
+ if _flags_itemInList 'item' ''; then
+ fail 'empty lists should not match'
+ fi
+}
+
+testUnderscoreName() {
+ # shellcheck disable=SC2162
+ while read desc name want; do
+ got=`_flags_underscoreName "${name}"`
+ assertEquals "${desc}: underscoreName(${name})" "${got}" "${want}"
+ done <<EOF
+with_dashes name-with-dashes name_with_dashes
+with_underscores name_with_underscores name_with_underscores
+just_alpha_numeric abc123 abc123
+empty "" ""
+EOF
+}
+
+testBool() {
+ # Valid values.
+ for value in ${TH_BOOL_VALID}; do
+ got=${FLAGS_TRUE}
+ if ! _flags_validBool "${value}"; then
+ got=${FLAGS_FALSE}
+ fi
+ assertTrue "valid value (${value}) did not validate" "${got}"
+ done
+
+ # Invalid values.
+ for value in ${TH_BOOL_INVALID}; do
+ got=${FLAGS_FALSE}
+ if _flags_validBool "${value}"; then
+ got=${FLAGS_TRUE}
+ fi
+ assertFalse "invalid value (${value}) validated" "${got}"
+ done
+}
+
+_testValidFloat() {
+ # Valid values.
+ for value in ${TH_INT_VALID} ${TH_FLOAT_VALID}; do
+ got=${FLAGS_TRUE}
+ if ! _flags_validFloat "${value}"; then
+ got=${FLAGS_FALSE}
+ fi
+ assertTrue "valid value (${value}) did not validate" "${got}"
+ done
+
+ # Invalid values.
+ for value in ${TH_FLOAT_INVALID}; do
+ got=${FLAGS_FALSE}
+ if _flags_validFloat "${value}"; then
+ got=${FLAGS_TRUE}
+ fi
+ assertFalse "invalid value (${value}) validated" "${got}"
+ done
+}
+
+testValidFloatBuiltin() {
+ if ! _flags_useBuiltin; then
+ startSkipping
+ fi
+ _testValidFloat
+}
+
+testValidFloatExpr() {
+ (
+ _flags_useBuiltin() { return "${FLAGS_FALSE}"; }
+ _testValidFloat
+ )
+}
+
+_testValidInt() {
+ # Valid values.
+ for value in ${TH_INT_VALID}; do
+ got=${FLAGS_TRUE}
+ if ! _flags_validInt "${value}"; then
+ got=${FLAGS_FALSE}
+ fi
+ assertTrue "valid value (${value}) did not validate" "${got}"
+ done
+
+ # Invalid values.
+ for value in ${TH_INT_INVALID}; do
+ got=${FLAGS_FALSE}
+ if _flags_validInt "${value}"; then
+ got=${FLAGS_TRUE}
+ fi
+ assertFalse "invalid value (${value}) should not validate" "${got}"
+ done
+}
+
+testValidIntBuiltin() {
+ if ! _flags_useBuiltin; then
+ startSkipping
+ fi
+ _testValidInt
+}
+
+testValidIntExpr() {
+ (
+ _flags_useBuiltin() { return "${FLAGS_FALSE}"; }
+ _testValidInt
+ )
+}
+
+_testMath() {
+ if result=`_flags_math 1`; then
+ assertEquals '1' 1 "${result}"
+ else
+ fail '1 failed'
+ fi
+
+ if result=`_flags_math '1 + 2'`; then
+ assertEquals '1+2' 3 "${result}"
+ else
+ fail '1+2 failed'
+ fi
+
+ if result=`_flags_math '1 + 2 + 3'`; then
+ assertEquals '1+2+3' 6 "${result}"
+ else
+ fail '1+2+3 failed'
+ fi
+
+ got=${FLAGS_TRUE}
+ if ! _flags_math >/dev/null 2>&1; then
+ got=${FLAGS_FALSE}
+ fi
+ assertFalse 'missing math succeeded' "${got}"
+}
+
+testMathBuiltin() {
+ _flags_useBuiltin || startSkipping
+ _testMath
+}
+
+testMathExpr() {
+ (
+ _flags_useBuiltin() { return "${FLAGS_FALSE}"; }
+ _testMath
+ )
+}
+
+_testStrlen() {
+ len=`_flags_strlen`
+ assertTrue 'missing argument failed' $?
+ assertEquals 'missing argument' 0 "${len}"
+
+ len=`_flags_strlen ''`
+ assertTrue 'empty argument failed' $?
+ assertEquals 'empty argument' 0 "${len}"
+
+ len=`_flags_strlen abc123`
+ assertTrue 'single-word failed' $?
+ assertEquals 'single-word' 6 "${len}"
+
+ len=`_flags_strlen 'This is a test'`
+ assertTrue 'multi-word failed' $?
+ assertEquals 'multi-word' 14 "${len}"
+}
+
+testStrlenBuiltin() {
+ _flags_useBuiltin || startSkipping
+ _testStrlen
+}
+
+testStrlenExpr() {
+ (
+ _flags_useBuiltin() { return "${FLAGS_FALSE}"; }
+ _testStrlen
+ )
+}
+
+oneTimeSetUp() {
+ th_oneTimeSetUp
+
+ _flags_useBuiltin || \
+ th_warn 'Shell built-ins not supported. Some tests will be skipped.'
+}
+
+tearDown() {
+ flags_reset
+}
+
+# Load and run shUnit2.
+# shellcheck disable=SC2034
+[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
+. "${TH_SHUNIT}"
diff --git a/shflags_public_test.sh b/shflags_public_test.sh
new file mode 100755
index 0000000..ad6eab1
--- /dev/null
+++ b/shflags_public_test.sh
@@ -0,0 +1,242 @@
+#! /bin/sh
+# vim:et:ft=sh:sts=2:sw=2
+#
+# shFlags unit test for the public functions.
+#
+# Copyright 2008-2020 Kate Ward. All Rights Reserved.
+# Released under the Apache 2.0 license.
+#
+# Author: kate.ward@forestent.com (Kate Ward)
+# https://github.com/kward/shflags
+#
+### ShellCheck (http://www.shellcheck.net/)
+# Disable source following.
+# shellcheck disable=SC1090,SC1091
+# $() are not fully portable (POSIX != portable).
+# shellcheck disable=SC2006
+
+# These variables will be overridden by the test helpers.
+expectedF="${TMPDIR:-/tmp}/expected"
+returnF="${TMPDIR:-/tmp}/return"
+stdoutF="${TMPDIR:-/tmp}/STDOUT"
+stderrF="${TMPDIR:-/tmp}/STDERR"
+
+# Load test helpers.
+. ./shflags_test_helpers
+
+testHelp() {
+ _testHelp '-h'
+ _testHelp '--help'
+}
+
+_testHelp() {
+ if ! flags_getoptIsEnh; then
+ return
+ fi
+
+ flag=$1
+
+ # Test default help output.
+ th_clearReturn
+ (
+ FLAGS "${flag}" >"${stdoutF}" 2>"${stderrF}"
+ echo $? >"${returnF}"
+ )
+ assertFalse \
+ 'short help request should have returned a false exit code.' \
+ "$(th_queryReturn)"
+ (grep 'show this help' "${stderrF}" >/dev/null)
+ r3turn=$?
+ assertTrue \
+ 'short request for help should have produced some help output.' \
+ ${r3turn}
+ [ ${r3turn} -ne "${FLAGS_TRUE}" ] && th_showOutput
+
+ # Test proper output when FLAGS_HELP set.
+ (
+ FLAGS_HELP='this is a test'
+ FLAGS "${flag}" >"${stdoutF}" 2>"${stderrF}"
+ )
+ (grep 'this is a test' "${stderrF}" >/dev/null)
+ r3turn=$?
+ assertTrue 'setting FLAGS_HELP did not produce expected result' ${r3turn}
+ [ ${r3turn} -ne "${FLAGS_TRUE}" ] && th_showOutput
+
+ # Test that "'" chars work in help string.
+ (
+ # shellcheck disable=SC2034
+ DEFINE_boolean b false "help string containing a ' char" b
+ FLAGS "${flag}" >"${stdoutF}" 2>"${stderrF}"
+ )
+ (grep "help string containing a ' char" "${stderrF}" >/dev/null)
+ r3turn=$?
+ assertTrue "help strings containing apostrophes don't work" ${r3turn}
+ [ ${r3turn} -ne "${FLAGS_TRUE}" ] && th_showOutput
+
+ return "${SHUNIT_TRUE}"
+}
+
+mock_flags_columns() {
+ echo 80
+}
+
+testStandardHelpOutput() {
+ if ! flags_getoptIsStd; then
+ startSkipping
+ fi
+
+ DEFINE_boolean test_bool false 'test boolean' b
+ DEFINE_integer test_int 0 'test integer' i
+ DEFINE_string test_str '' 'test string' s
+ DEFINE_string long_desc 'blah' \
+ 'testing of a long description to force wrap of default value' D
+ DEFINE_string long_default \
+ 'this_is_a_long_default_value_to_force_alternate_indentation' \
+ 'testing of long default value' F
+
+ # Test for https://github.com/kward/shflags/issues/28.
+ DEFINE_boolean 'force' false '' f
+
+ help='USAGE: standard [flags] args'
+
+ cat >"${expectedF}" <<EOF
+${help}
+flags:
+ -b test boolean (default: false)
+ -i test integer (default: 0)
+ -s test string (default: '')
+ -D testing of a long description to force wrap of default value
+ (default: 'blah')
+ -F testing of long default value
+ (default: 'this_is_a_long_default_value_to_force_alternate_indentation')
+ -f (default: false)
+ -h show this help (default: false)
+EOF
+ (
+ _flags_columns() { mock_flags_columns; }
+ FLAGS_HELP=${help};
+ # Wrap FLAGS call in if/then/else so 'set -e' works properly.
+ if FLAGS -h >"${stdoutF}" 2>"${stderrF}"; then
+ rtrn=$?
+ else
+ rtrn=$?
+ fi
+ echo "${rtrn}" >"${returnF}"
+ )
+ assertFalse 'a call for help should return a non-zero exit code.' "$(th_queryReturn)"
+
+ if ! diff "${expectedF}" "${stderrF}" >/dev/null; then
+ fail 'unexpected help output'
+ th_showOutput
+ fi
+}
+
+testEnhancedHelpOutput() {
+ if ! flags_getoptIsEnh; then
+ startSkipping
+ fi
+
+ # shellcheck disable=SC2034
+ DEFINE_boolean test_bool false 'test boolean' b
+ # shellcheck disable=SC2034
+ DEFINE_integer test_int 0 'test integer' i
+ # shellcheck disable=SC2034
+ DEFINE_string test_str '' 'test string' s
+ # shellcheck disable=SC2034
+ DEFINE_string long_desc 'blah' \
+ 'testing of a long description to force wrap of default value' D
+ # shellcheck disable=SC2034
+ DEFINE_string long_default \
+ 'this_is_a_long_default_value_to_force_alternate_indentation' \
+ 'testing of long default value' F
+
+ # Test for https://github.com/kward/shflags/issues/28.
+ DEFINE_boolean 'force' false '' f
+
+ help='USAGE: enhanced [flags] args'
+
+ cat >"${expectedF}" <<EOF
+${help}
+flags:
+ -b,--[no]test_bool: test boolean (default: false)
+ -i,--test_int: test integer (default: 0)
+ -s,--test_str: test string (default: '')
+ -D,--long_desc: testing of a long description to force wrap of default value
+ (default: 'blah')
+ -F,--long_default: testing of long default value
+ (default: 'this_is_a_long_default_value_to_force_alternate_indentation')
+ -f,--[no]force: (default: false)
+ -h,--help: show this help (default: false)
+EOF
+ (
+ _flags_columns() { mock_flags_columns; }
+ # shellcheck disable=SC2034
+ FLAGS_HELP=${help}
+ # Wrap FLAGS call in if/then/else so 'set -e' works properly.
+ if FLAGS -h >"${stdoutF}" 2>"${stderrF}"; then
+ rtrn=$?
+ else
+ rtrn=$?
+ fi
+ echo "${rtrn}" >"${returnF}"
+ )
+ assertFalse 'a call for help should return a non-zero exit code.' "$(th_queryReturn)"
+
+ if ! diff "${expectedF}" "${stderrF}" >/dev/null; then
+ fail 'unexpected help output'
+ th_showOutput
+ fi
+}
+
+testNoHelp() {
+ if ! flags_getoptIsEnh; then
+ startSkipping
+ fi
+
+ ( FLAGS --nohelp >"${stdoutF}" 2>"${stderrF}" )
+ r3turn=$?
+ assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn}
+ assertFalse 'expected no output to STDOUT' "[ -s '${stdoutF}' ]"
+ assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
+}
+
+testLoggingLevel() {
+ # Check that the default logging level is set properly.
+ got=`flags_loggingLevel` want=${__FLAGS_LEVEL_DEFAULT}
+ assertTrue "Unexpected default logging level = ${got}, want ${want}" "[ ${got} -eq ${want} ]"
+
+ # Override the logging level, and check again.
+ flags_setLoggingLevel "${FLAGS_LEVEL_FATAL}"
+ flags_setLoggingLevel "${FLAGS_LEVEL_INFO}"
+ got=`flags_loggingLevel` want=${FLAGS_LEVEL_INFO}
+ assertTrue "Unexpected configured logging level = ${got}, want ${want}" "[ ${got} -eq ${want} ]"
+}
+
+# According to https://github.com/kward/shflags/issues/28
+#
+# DEFINE_boolean misbehaves when help-string is empty
+testIssue28() {
+ # shellcheck disable=SC2034
+ DEFINE_boolean 'force' false '' f
+
+ testHelp && return
+}
+
+oneTimeSetUp() {
+ th_oneTimeSetUp
+
+ if flags_getoptIsStd; then
+ th_warn 'Standard version of getopt found. Enhanced tests will be skipped.'
+ return
+ fi
+ th_warn 'Enhanced version of getopt found. Standard tests will be skipped.'
+}
+
+setUp() {
+ flags_reset
+}
+
+# Load and run shUnit2.
+# shellcheck disable=SC2034
+[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
+. "${TH_SHUNIT}"
diff --git a/shflags_test_helpers b/shflags_test_helpers
new file mode 100644
index 0000000..f5d2191
--- /dev/null
+++ b/shflags_test_helpers
@@ -0,0 +1,137 @@
+# vim:et:ft=sh:sts=2:sw=2
+#
+# shFlags unit test common functions
+#
+# Copyright 2008-2018 Kate Ward. All Rights Reserved.
+# Released under the Apache 2.0 license.
+#
+# Author: kate.ward@forestent.com (Kate Ward)
+# https://github.com/kward/shflags
+#
+### ShellCheck (http://www.shellcheck.net/)
+# Disable source following.
+# shellcheck disable=SC1090,SC1091
+# $() are not fully portable (POSIX != portable).
+# shellcheck disable=SC2006
+# Arrays are not available in all shells.
+# shellcheck disable=SC2089
+# Exporting variables shouldn't impact their contents.
+# shellcheck disable=SC2090
+# Disagree with [ p ] && [ q ] vs [ p -a -q ] recommendation.
+# shellcheck disable=SC2166
+
+# Exit immediately if a simple command exits with a non-zero status.
+set -e
+
+# Treat unset variables as an error when performing parameter expansion.
+set -u
+
+# Set shwordsplit for zsh.
+[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit
+
+# Message functions.
+th_trace() { echo "test:TRACE $*" >&2; }
+th_debug() { echo "test:DEBUG $*" >&2; }
+th_info() { echo "test:INFO $*" >&2; }
+th_warn() { echo "test:WARN $*" >&2; }
+th_error() { echo "test:ERROR $*" >&2; }
+th_fatal() { echo "test:FATAL $*" >&2; exit 1; }
+
+# Path to shFlags library. Can be overridden by setting SHFLAGS_INC.
+TH_SHFLAGS=${SHFLAGS_INC:-./shflags}; export TH_SHFLAGS
+
+# Path to shUnit2 library. Can be overridden by setting SHUNIT_INC.
+TH_SHUNIT=${SHUNIT_INC:-lib/shunit2}; export TH_SHUNIT
+
+TH_BOOL_VALID='true t 0 false f 1'; export TH_BOOL_VALID
+TH_BOOL_INVALID='123 123.0 invalid'; export TH_BOOL_INVALID
+TH_FLOAT_VALID='-1234.0 -1.0 -.123 0.0 0. .123 1.0 1234.0'
+export TH_FLOAT_VALID
+TH_FLOAT_INVALID='true false 1.2.3 -1.2.3 ""'; export TH_FLOAT_INVALID
+TH_INT_VALID='-1234 -1 0 1 1234'; export TH_INT_VALID
+TH_INT_INVALID='true false -1.0 -.123 0.0 .123 1.0 ""'; export TH_INT_INVALID
+
+#
+# Test helper functions.
+#
+
+th_oneTimeSetUp() {
+ # Load shFlags.
+ # shellcheck disable=SC2034
+ [ -n "${ZSH_VERSION:-}" ] && FLAGS_PARENT=$0
+ . "${TH_SHFLAGS}"
+
+ # These files will be cleaned up automatically by shUnit2.
+ tmpDir=${SHUNIT_TMPDIR}; export tmpDir
+ stdoutF="${tmpDir}/stdout" && touch "${stdoutF}"
+ stderrF="${tmpDir}/stderr" && touch "${stderrF}"
+ returnF="${tmpDir}/return" && touch "${returnF}"
+ expectedF="${tmpDir}/expected" && touch "${expectedF}"
+}
+
+th_showOutput() {
+ if isSkipping; then
+ return
+ fi
+
+ _th_return="${1:-${returnF}}"
+ _th_stdout="${2:-${stdoutF}}"
+ _th_stderr="${3:-${stderrF}}"
+
+ if [ "${_th_return}" != "${FLAGS_TRUE}" ]; then
+ # shellcheck disable=SC2166
+ if [ -n "${_th_stdout}" -a -s "${_th_stdout}" ]; then
+ echo '>>> STDOUT' >&2
+ cat "${_th_stdout}" >&2
+ echo '<<< STDOUT' >&2
+ fi
+ # shellcheck disable=SC2166
+ if [ -n "${_th_stderr}" -a -s "${_th_stderr}" ]; then
+ echo '>>> STDERR' >&2
+ cat "${_th_stderr}" >&2
+ echo '<<< STDERR' >&2
+ fi
+ fi
+
+ unset _th_rtrn _th_stdout _th_stderr
+}
+
+# Some shells, zsh on Solaris in particular, return immediately from a sub-shell
+# when a non-zero return value is encountered. To properly catch these values,
+# they are either written to disk, or recognized as an error the file is empty.
+th_clearReturn() { cp /dev/null "${returnF}"; }
+th_queryReturn() {
+ if [ -s "${returnF}" ]; then
+ cat "${returnF}"
+ return $?
+ fi
+ echo "${SHUNIT_ERROR}"
+ return "${SHUNIT_ERROR}"
+}
+
+assertWarnMsg() { _th_assertMsg 'WARN' "${1:-}" "${2:-}"; }
+assertErrorMsg() { _th_assertMsg 'ERROR' "${1:-}" "${2:-}"; }
+assertFatalMsg() { _th_assertMsg 'FATAL' "${1:-}" "${2:-}"; }
+
+_th_assertMsg() {
+ _th_alert_type_=$1
+ _th_alert_msg_=$2
+ _th_msg_=$3
+
+ case ${_th_alert_type_} in
+ WARN) _th_alert_str_='a warning' ;;
+ ERROR) _th_alert_str_='an error' ;;
+ FATAL) _th_alert_str_='a fatal' ;;
+ esac
+ if [ -z "${_th_alert_msg_}" ]; then
+ _th_alert_msg_='.*'
+ fi
+ if [ -n "${_th_msg_}" ]; then
+ _th_msg_="(${_th_msg_}) "
+ fi
+
+ (grep -- "^flags:${_th_alert_type_} ${_th_alert_msg_}" "${stderrF}" >/dev/null)
+ assertEquals "FLAGS ${_th_msg_}failure did not generate ${_th_alert_str_} message" "${FLAGS_TRUE}" $?
+
+ unset _th_alert_type_ _th_alert_msg_ _th_alert_str_ _th_msg_
+}
diff --git a/src/shflags b/src/shflags
deleted file mode 100644
index 11d3060..0000000
--- a/src/shflags
+++ /dev/null
@@ -1,1155 +0,0 @@
-# vim:et:ft=sh:sts=2:sw=2
-#
-# Copyright 2008-2016 Kate Ward. All Rights Reserved.
-# Released under the Apache License 2.0.
-#
-# shFlags -- Advanced command-line flag library for Unix shell scripts.
-# http://code.google.com/p/shflags/
-#
-# Author: kate.ward@forestent.com (Kate Ward)
-#
-# This module implements something like the google-gflags library available
-# from http://code.google.com/p/google-gflags/.
-#
-# FLAG TYPES: This is a list of the DEFINE_*'s that you can do. All flags take
-# a name, default value, help-string, and optional 'short' name (one-letter
-# name). Some flags have other arguments, which are described with the flag.
-#
-# DEFINE_string: takes any input, and intreprets it as a string.
-#
-# DEFINE_boolean: does not take any arguments. Say --myflag to set
-# FLAGS_myflag to true, or --nomyflag to set FLAGS_myflag to false. For short
-# flags, passing the flag on the command-line negates the default value, i.e.
-# if the default is true, passing the flag sets the value to false.
-#
-# DEFINE_float: takes an input and intreprets it as a floating point number. As
-# shell does not support floats per-se, the input is merely validated as
-# being a valid floating point value.
-#
-# DEFINE_integer: takes an input and intreprets it as an integer.
-#
-# SPECIAL FLAGS: There are a few flags that have special meaning:
-# --help (or -?) prints a list of all the flags in a human-readable fashion
-# --flagfile=foo read flags from foo. (not implemented yet)
-# -- as in getopt(), terminates flag-processing
-#
-# EXAMPLE USAGE:
-#
-# -- begin hello.sh --
-# #! /bin/sh
-# . ./shflags
-# DEFINE_string name 'world' "somebody's name" n
-# FLAGS "$@" || exit $?
-# eval set -- "${FLAGS_ARGV}"
-# echo "Hello, ${FLAGS_name}."
-# -- end hello.sh --
-#
-# $ ./hello.sh -n Kate
-# Hello, Kate.
-#
-# CUSTOMIZABLE BEHAVIOR:
-#
-# A script can override the default 'getopt' command by providing the path to
-# an alternate implementation by defining the FLAGS_GETOPT_CMD variable.
-#
-# NOTES:
-#
-# * Not all systems include a getopt version that supports long flags. On these
-# systems, only short flags are recognized.
-
-#==============================================================================
-# shFlags
-#
-# Shared attributes:
-# flags_error: last error message
-# flags_output: last function output (rarely valid)
-# flags_return: last return value
-#
-# __flags_longNames: list of long names for all flags
-# __flags_shortNames: list of short names for all flags
-# __flags_boolNames: list of boolean flag names
-#
-# __flags_opts: options parsed by getopt
-#
-# Per-flag attributes:
-# FLAGS_<flag_name>: contains value of flag named 'flag_name'
-# __flags_<flag_name>_default: the default flag value
-# __flags_<flag_name>_help: the flag help string
-# __flags_<flag_name>_short: the flag short name
-# __flags_<flag_name>_type: the flag type
-#
-# Notes:
-# - lists of strings are space separated, and a null value is the '~' char.
-
-# return if FLAGS already loaded
-[ -n "${FLAGS_VERSION:-}" ] && return 0
-FLAGS_VERSION='1.2.0'
-
-# return values that scripts can use
-FLAGS_TRUE=0
-FLAGS_FALSE=1
-FLAGS_ERROR=2
-
-# determine some reasonable command defaults
-__FLAGS_UNAME_S=`uname -s`
-case "${__FLAGS_UNAME_S}" in
- BSD) __FLAGS_EXPR_CMD='gexpr' ;;
- *) __FLAGS_EXPR_CMD='expr' ;;
-esac
-
-# commands a user can override if needed
-FLAGS_EXPR_CMD=${FLAGS_EXPR_CMD:-${__FLAGS_EXPR_CMD}}
-FLAGS_GETOPT_CMD=${FLAGS_GETOPT_CMD:-getopt}
-
-# specific shell checks
-if [ -n "${ZSH_VERSION:-}" ]; then
- setopt |grep "^shwordsplit$" >/dev/null
- if [ $? -ne ${FLAGS_TRUE} ]; then
- _flags_fatal 'zsh shwordsplit option is required for proper zsh operation'
- fi
- if [ -z "${FLAGS_PARENT:-}" ]; then
- _flags_fatal "zsh does not pass \$0 through properly. please declare' \
-\"FLAGS_PARENT=\$0\" before calling shFlags"
- fi
-fi
-
-# can we use built-ins?
-( echo "${FLAGS_TRUE#0}"; ) >/dev/null 2>&1
-if [ $? -eq ${FLAGS_TRUE} ]; then
- __FLAGS_USE_BUILTIN=${FLAGS_TRUE}
-else
- __FLAGS_USE_BUILTIN=${FLAGS_FALSE}
-fi
-
-#
-# constants
-#
-
-# reserved flag names
-__FLAGS_RESERVED_LIST=' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE '
-__FLAGS_RESERVED_LIST="${__FLAGS_RESERVED_LIST} VERSION "
-
-# getopt version
-__FLAGS_GETOPT_VERS_STD=0
-__FLAGS_GETOPT_VERS_ENH=1
-__FLAGS_GETOPT_VERS_BSD=2
-
-${FLAGS_GETOPT_CMD} >/dev/null 2>&1
-case $? in
- 0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;; # bsd getopt
- 2)
- # TODO(kward): look into '-T' option to test the internal getopt() version
- if [ "`${FLAGS_GETOPT_CMD} --version`" = '-- ' ]; then
- __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD}
- else
- __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_ENH}
- fi
- ;;
- *) _flags_fatal 'unable to determine getopt version' ;;
-esac
-
-# getopt optstring lengths
-__FLAGS_OPTSTR_SHORT=0
-__FLAGS_OPTSTR_LONG=1
-
-__FLAGS_NULL='~'
-
-# flag info strings
-__FLAGS_INFO_DEFAULT='default'
-__FLAGS_INFO_HELP='help'
-__FLAGS_INFO_SHORT='short'
-__FLAGS_INFO_TYPE='type'
-
-# flag lengths
-__FLAGS_LEN_SHORT=0
-__FLAGS_LEN_LONG=1
-
-# flag types
-__FLAGS_TYPE_NONE=0
-__FLAGS_TYPE_BOOLEAN=1
-__FLAGS_TYPE_FLOAT=2
-__FLAGS_TYPE_INTEGER=3
-__FLAGS_TYPE_STRING=4
-
-# set the constants readonly
-__flags_constants=`set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'`
-for __flags_const in ${__flags_constants}; do
- # skip certain flags
- case ${__flags_const} in
- FLAGS_HELP) continue ;;
- FLAGS_PARENT) continue ;;
- esac
- # set flag readonly
- if [ -z "${ZSH_VERSION:-}" ]; then
- readonly ${__flags_const}
- else # handle zsh
- case ${ZSH_VERSION} in
- [123].*) readonly ${__flags_const} ;;
- *) readonly -g ${__flags_const} ;; # declare readonly constants globally
- esac
- fi
-done
-unset __flags_const __flags_constants
-
-#
-# internal variables
-#
-
-# space separated lists
-__flags_boolNames=' ' # boolean flag names
-__flags_longNames=' ' # long flag names
-__flags_shortNames=' ' # short flag names
-__flags_definedNames=' ' # defined flag names (used for validation)
-
-__flags_columns='' # screen width in columns
-__flags_opts='' # temporary storage for parsed getopt flags
-
-#------------------------------------------------------------------------------
-# private functions
-#
-
-# logging functions
-_flags_debug() { echo "flags:DEBUG $@" >&2; }
-_flags_warn() { echo "flags:WARN $@" >&2; }
-_flags_error() { echo "flags:ERROR $@" >&2; }
-_flags_fatal() { echo "flags:FATAL $@" >&2; exit ${FLAGS_ERROR}; }
-
-# Define a flag.
-#
-# Calling this function will define the following info variables for the
-# specified flag:
-# FLAGS_flagname - the name for this flag (based upon the long flag name)
-# __flags_<flag_name>_default - the default value
-# __flags_flagname_help - the help string
-# __flags_flagname_short - the single letter alias
-# __flags_flagname_type - the type of flag (one of __FLAGS_TYPE_*)
-#
-# Args:
-# _flags__type: integer: internal type of flag (__FLAGS_TYPE_*)
-# _flags__name: string: long flag name
-# _flags__default: default flag value
-# _flags__help: string: help string
-# _flags__short: string: (optional) short flag name
-# Returns:
-# integer: success of operation, or error
-_flags_define()
-{
- if [ $# -lt 4 ]; then
- flags_error='DEFINE error: too few arguments'
- flags_return=${FLAGS_ERROR}
- _flags_error "${flags_error}"
- return ${flags_return}
- fi
-
- _flags_type_=$1
- _flags_name_=$2
- _flags_default_=$3
- _flags_help_=$4
- _flags_short_=${5:-${__FLAGS_NULL}}
-
- _flags_return_=${FLAGS_TRUE}
- _flags_usName_=`_flags_underscoreName ${_flags_name_}`
-
- # check whether the flag name is reserved
- _flags_itemInList ${_flags_usName_} "${__FLAGS_RESERVED_LIST}"
- if [ $? -eq ${FLAGS_TRUE} ]; then
- flags_error="flag name (${_flags_name_}) is reserved"
- _flags_return_=${FLAGS_ERROR}
- fi
-
- # require short option for getopt that don't support long options
- if [ ${_flags_return_} -eq ${FLAGS_TRUE} \
- -a ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} \
- -a "${_flags_short_}" = "${__FLAGS_NULL}" ]
- then
- flags_error="short flag required for (${_flags_name_}) on this platform"
- _flags_return_=${FLAGS_ERROR}
- fi
-
- # check for existing long name definition
- if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
- if _flags_itemInList ${_flags_usName_} ${__flags_definedNames}; then
- flags_error="definition for ([no]${_flags_name_}) already exists"
- _flags_warn "${flags_error}"
- _flags_return_=${FLAGS_FALSE}
- fi
- fi
-
- # check for existing short name definition
- if [ ${_flags_return_} -eq ${FLAGS_TRUE} \
- -a "${_flags_short_}" != "${__FLAGS_NULL}" ]
- then
- if _flags_itemInList "${_flags_short_}" ${__flags_shortNames}; then
- flags_error="flag short name (${_flags_short_}) already defined"
- _flags_warn "${flags_error}"
- _flags_return_=${FLAGS_FALSE}
- fi
- fi
-
- # handle default value. note, on several occasions the 'if' portion of an
- # if/then/else contains just a ':' which does nothing. a binary reversal via
- # '!' is not done because it does not work on all shells.
- if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
- case ${_flags_type_} in
- ${__FLAGS_TYPE_BOOLEAN})
- if _flags_validBool "${_flags_default_}"; then
- case ${_flags_default_} in
- true|t|0) _flags_default_=${FLAGS_TRUE} ;;
- false|f|1) _flags_default_=${FLAGS_FALSE} ;;
- esac
- else
- flags_error="invalid default flag value '${_flags_default_}'"
- _flags_return_=${FLAGS_ERROR}
- fi
- ;;
-
- ${__FLAGS_TYPE_FLOAT})
- if _flags_validFloat "${_flags_default_}"; then
- :
- else
- flags_error="invalid default flag value '${_flags_default_}'"
- _flags_return_=${FLAGS_ERROR}
- fi
- ;;
-
- ${__FLAGS_TYPE_INTEGER})
- if _flags_validInt "${_flags_default_}"; then
- :
- else
- flags_error="invalid default flag value '${_flags_default_}'"
- _flags_return_=${FLAGS_ERROR}
- fi
- ;;
-
- ${__FLAGS_TYPE_STRING}) ;; # everything in shell is a valid string
-
- *)
- flags_error="unrecognized flag type '${_flags_type_}'"
- _flags_return_=${FLAGS_ERROR}
- ;;
- esac
- fi
-
- if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
- # store flag information
- eval "FLAGS_${_flags_usName_}='${_flags_default_}'"
- eval "__flags_${_flags_usName_}_${__FLAGS_INFO_TYPE}=${_flags_type_}"
- eval "__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}=\
-\"${_flags_default_}\""
- eval "__flags_${_flags_usName_}_${__FLAGS_INFO_HELP}=\"${_flags_help_}\""
- eval "__flags_${_flags_usName_}_${__FLAGS_INFO_SHORT}='${_flags_short_}'"
-
- # append flag names to name lists
- __flags_shortNames="${__flags_shortNames}${_flags_short_} "
- __flags_longNames="${__flags_longNames}${_flags_name_} "
- [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \
- __flags_boolNames="${__flags_boolNames}no${_flags_name_} "
-
- # append flag names to defined names for later validation checks
- __flags_definedNames="${__flags_definedNames}${_flags_usName_} "
- [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] && \
- __flags_definedNames="${__flags_definedNames}no${_flags_usName_} "
- fi
-
- flags_return=${_flags_return_}
- unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ \
- _flags_short_ _flags_type_ _flags_usName_
- [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_error "${flags_error}"
- return ${flags_return}
-}
-
-# Underscore a flag name by replacing dashes with underscores.
-#
-# Args:
-# unnamed: string: log flag name
-# Output:
-# string: underscored name
-_flags_underscoreName()
-{
- echo $1 |tr '-' '_'
-}
-
-# Return valid getopt options using currently defined list of long options.
-#
-# This function builds a proper getopt option string for short (and long)
-# options, using the current list of long options for reference.
-#
-# Args:
-# _flags_optStr: integer: option string type (__FLAGS_OPTSTR_*)
-# Output:
-# string: generated option string for getopt
-# Returns:
-# boolean: success of operation (always returns True)
-_flags_genOptStr()
-{
- _flags_optStrType_=$1
-
- _flags_opts_=''
-
- for _flags_name_ in ${__flags_longNames}; do
- _flags_usName_=`_flags_underscoreName ${_flags_name_}`
- _flags_type_=`_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}`
- [ $? -eq ${FLAGS_TRUE} ] || _flags_fatal 'call to _flags_type_ failed'
- case ${_flags_optStrType_} in
- ${__FLAGS_OPTSTR_SHORT})
- _flags_shortName_=`_flags_getFlagInfo \
- ${_flags_usName_} ${__FLAGS_INFO_SHORT}`
- if [ "${_flags_shortName_}" != "${__FLAGS_NULL}" ]; then
- _flags_opts_="${_flags_opts_}${_flags_shortName_}"
- # getopt needs a trailing ':' to indicate a required argument
- [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \
- _flags_opts_="${_flags_opts_}:"
- fi
- ;;
-
- ${__FLAGS_OPTSTR_LONG})
- _flags_opts_="${_flags_opts_:+${_flags_opts_},}${_flags_name_}"
- # getopt needs a trailing ':' to indicate a required argument
- [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \
- _flags_opts_="${_flags_opts_}:"
- ;;
- esac
- done
-
- echo "${_flags_opts_}"
- unset _flags_name_ _flags_opts_ _flags_optStrType_ _flags_shortName_ \
- _flags_type_ _flags_usName_
- return ${FLAGS_TRUE}
-}
-
-# Returns flag details based on a flag name and flag info.
-#
-# Args:
-# string: underscored flag name
-# string: flag info (see the _flags_define function for valid info types)
-# Output:
-# string: value of dereferenced flag variable
-# Returns:
-# integer: one of FLAGS_{TRUE|FALSE|ERROR}
-_flags_getFlagInfo()
-{
- # note: adding gFI to variable names to prevent naming conflicts with calling
- # functions
- _flags_gFI_usName_=$1
- _flags_gFI_info_=$2
-
- _flags_infoVar_="__flags_${_flags_gFI_usName_}_${_flags_gFI_info_}"
- _flags_strToEval_="_flags_infoValue_=\"\${${_flags_infoVar_}:-}\""
- eval "${_flags_strToEval_}"
- if [ -n "${_flags_infoValue_}" ]; then
- flags_return=${FLAGS_TRUE}
- else
- # see if the _flags_gFI_usName_ variable is a string as strings can be
- # empty...
- # note: the DRY principle would say to have this function call itself for
- # the next three lines, but doing so results in an infinite loop as an
- # invalid _flags_name_ will also not have the associated _type variable.
- # Because it doesn't (it will evaluate to an empty string) the logic will
- # try to find the _type variable of the _type variable, and so on. Not so
- # good ;-)
- _flags_typeVar_="__flags_${_flags_gFI_usName_}_${__FLAGS_INFO_TYPE}"
- _flags_strToEval_="_flags_typeValue_=\"\${${_flags_typeVar_}:-}\""
- eval "${_flags_strToEval_}"
- if [ "${_flags_typeValue_}" = "${__FLAGS_TYPE_STRING}" ]; then
- flags_return=${FLAGS_TRUE}
- else
- flags_return=${FLAGS_ERROR}
- flags_error="missing flag info variable (${_flags_infoVar_})"
- fi
- fi
-
- echo "${_flags_infoValue_}"
- unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ \
- _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
- [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_error "${flags_error}"
- return ${flags_return}
-}
-
-# Check for presense of item in a list.
-#
-# Passed a string (e.g. 'abc'), this function will determine if the string is
-# present in the list of strings (e.g. ' foo bar abc ').
-#
-# Args:
-# _flags_str_: string: string to search for in a list of strings
-# unnamed: list: list of strings
-# Returns:
-# boolean: true if item is in the list
-_flags_itemInList() {
- _flags_str_=$1
- shift
-
- echo " ${*:-} " |grep " ${_flags_str_} " >/dev/null
- if [ $? -eq 0 ]; then
- flags_return=${FLAGS_TRUE}
- else
- flags_return=${FLAGS_FALSE}
- fi
-
- unset _flags_str_
- return ${flags_return}
-}
-
-# Returns the width of the current screen.
-#
-# Output:
-# integer: width in columns of the current screen.
-_flags_columns()
-{
- if [ -z "${__flags_columns}" ]; then
- # determine the value and store it
- if eval stty size >/dev/null 2>&1; then
- # stty size worked :-)
- set -- `stty size`
- __flags_columns=$2
- elif eval tput cols >/dev/null 2>&1; then
- set -- `tput cols`
- __flags_columns=$1
- else
- __flags_columns=80 # default terminal width
- fi
- fi
- echo ${__flags_columns}
-}
-
-# Validate a boolean.
-#
-# Args:
-# _flags__bool: boolean: value to validate
-# Returns:
-# bool: true if the value is a valid boolean
-_flags_validBool()
-{
- _flags_bool_=$1
-
- flags_return=${FLAGS_TRUE}
- case "${_flags_bool_}" in
- true|t|0) ;;
- false|f|1) ;;
- *) flags_return=${FLAGS_FALSE} ;;
- esac
-
- unset _flags_bool_
- return ${flags_return}
-}
-
-# Validate a float.
-#
-# Args:
-# _flags_float_: float: value to validate
-# Returns:
-# bool: true if the value is a valid integer
-_flags_validFloat()
-{
- flags_return=${FLAGS_FALSE}
- [ -n "$1" ] || return ${flags_return}
- _flags_float_=$1
-
- if _flags_validInt ${_flags_float_}; then
- flags_return=${FLAGS_TRUE}
- elif _flags_useBuiltin; then
- _flags_float_whole_=${_flags_float_%.*}
- _flags_float_fraction_=${_flags_float_#*.}
- if _flags_validInt ${_flags_float_whole_:-0} -a \
- _flags_validInt ${_flags_float_fraction_}; then
- flags_return=${FLAGS_TRUE}
- fi
- unset _flags_float_whole_ _flags_float_fraction_
- else
- flags_return=${FLAGS_TRUE}
- case ${_flags_float_} in
- -*) # negative floats
- _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\
- '\(-[0-9]*\.[0-9]*\)'`
- ;;
- *) # positive floats
- _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\
- '\([0-9]*\.[0-9]*\)'`
- ;;
- esac
- [ "${_flags_test_}" != "${_flags_float_}" ] && flags_return=${FLAGS_FALSE}
- unset _flags_test_
- fi
-
- unset _flags_float_ _flags_float_whole_ _flags_float_fraction_
- return ${flags_return}
-}
-
-# Validate an integer.
-#
-# Args:
-# _flags_int_: integer: value to validate
-# Returns:
-# bool: true if the value is a valid integer
-_flags_validInt()
-{
- flags_return=${FLAGS_FALSE}
- [ -n "$1" ] || return ${flags_return}
- _flags_int_=$1
-
- case ${_flags_int_} in
- -*.*) ;; # ignore negative floats (we'll invalidate them later)
- -*) # strip possible leading negative sign
- if _flags_useBuiltin; then
- _flags_int_=${_flags_int_#-}
- else
- _flags_int_=`${FLAGS_EXPR_CMD} -- "${_flags_int_}" : '-\([0-9][0-9]*\)'`
- fi
- ;;
- esac
-
- case ${_flags_int_} in
- *[!0-9]*) flags_return=${FLAGS_FALSE} ;;
- *) flags_return=${FLAGS_TRUE} ;;
- esac
-
- unset _flags_int_
- return ${flags_return}
-}
-
-# Parse command-line options using the standard getopt.
-#
-# Note: the flag options are passed around in the global __flags_opts so that
-# the formatting is not lost due to shell parsing and such.
-#
-# Args:
-# @: varies: command-line options to parse
-# Returns:
-# integer: a FLAGS success condition
-_flags_getoptStandard()
-{
- flags_return=${FLAGS_TRUE}
- _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}`
-
- # check for spaces in passed options
- for _flags_opt_ in "$@"; do
- # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
- _flags_match_=`echo "x${_flags_opt_}x" |sed 's/ //g'`
- if [ "${_flags_match_}" != "x${_flags_opt_}x" ]; then
- flags_error='the available getopt does not support spaces in options'
- flags_return=${FLAGS_ERROR}
- break
- fi
- done
-
- if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then
- __flags_opts=`getopt ${_flags_shortOpts_} $@ 2>&1`
- _flags_rtrn_=$?
- if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then
- _flags_warn "${__flags_opts}"
- flags_error='unable to parse provided options with getopt.'
- flags_return=${FLAGS_ERROR}
- fi
- fi
-
- unset _flags_match_ _flags_opt_ _flags_rtrn_ _flags_shortOpts_
- return ${flags_return}
-}
-
-# Parse command-line options using the enhanced getopt.
-#
-# Note: the flag options are passed around in the global __flags_opts so that
-# the formatting is not lost due to shell parsing and such.
-#
-# Args:
-# @: varies: command-line options to parse
-# Returns:
-# integer: a FLAGS success condition
-_flags_getoptEnhanced()
-{
- flags_return=${FLAGS_TRUE}
- _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}`
- _flags_boolOpts_=`echo "${__flags_boolNames}" \
- |sed 's/^ *//;s/ *$//;s/ /,/g'`
- _flags_longOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_LONG}`
-
- __flags_opts=`${FLAGS_GETOPT_CMD} \
- -o ${_flags_shortOpts_} \
- -l "${_flags_longOpts_},${_flags_boolOpts_}" \
- -- "$@" 2>&1`
- _flags_rtrn_=$?
- if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then
- _flags_warn "${__flags_opts}"
- flags_error='unable to parse provided options with getopt.'
- flags_return=${FLAGS_ERROR}
- fi
-
- unset _flags_boolOpts_ _flags_longOpts_ _flags_rtrn_ _flags_shortOpts_
- return ${flags_return}
-}
-
-# Dynamically parse a getopt result and set appropriate variables.
-#
-# This function does the actual conversion of getopt output and runs it through
-# the standard case structure for parsing. The case structure is actually quite
-# dynamic to support any number of flags.
-#
-# Args:
-# argc: int: original command-line argument count
-# @: varies: output from getopt parsing
-# Returns:
-# integer: a FLAGS success condition
-_flags_parseGetopt()
-{
- _flags_argc_=$1
- shift
-
- flags_return=${FLAGS_TRUE}
-
- if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then
- set -- $@
- else
- # note the quotes around the `$@' -- they are essential!
- eval set -- "$@"
- fi
-
- # Provide user with the number of arguments to shift by later.
- # NOTE: the FLAGS_ARGC variable is obsolete as of 1.0.3 because it does not
- # properly give user access to non-flag arguments mixed in between flag
- # arguments. Its usage was replaced by FLAGS_ARGV, and it is being kept only
- # for backwards compatibility reasons.
- FLAGS_ARGC=`_flags_math "$# - 1 - ${_flags_argc_}"`
-
- # handle options. note options with values must do an additional shift
- while true; do
- _flags_opt_=$1
- _flags_arg_=${2:-}
- _flags_type_=${__FLAGS_TYPE_NONE}
- _flags_name_=''
-
- # determine long flag name
- case "${_flags_opt_}" in
- --) shift; break ;; # discontinue option parsing
-
- --*) # long option
- if _flags_useBuiltin; then
- _flags_opt_=${_flags_opt_#*--}
- else
- _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '--\(.*\)'`
- fi
- _flags_len_=${__FLAGS_LEN_LONG}
- if _flags_itemInList "${_flags_opt_}" ${__flags_longNames}; then
- _flags_name_=${_flags_opt_}
- else
- # check for negated long boolean version
- if _flags_itemInList "${_flags_opt_}" ${__flags_boolNames}; then
- if _flags_useBuiltin; then
- _flags_name_=${_flags_opt_#*no}
- else
- _flags_name_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : 'no\(.*\)'`
- fi
- _flags_type_=${__FLAGS_TYPE_BOOLEAN}
- _flags_arg_=${__FLAGS_NULL}
- fi
- fi
- ;;
-
- -*) # short option
- if _flags_useBuiltin; then
- _flags_opt_=${_flags_opt_#*-}
- else
- _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '-\(.*\)'`
- fi
- _flags_len_=${__FLAGS_LEN_SHORT}
- if _flags_itemInList "${_flags_opt_}" ${__flags_shortNames}; then
- # yes. match short name to long name. note purposeful off-by-one
- # (too high) with awk calculations.
- _flags_pos_=`echo "${__flags_shortNames}" \
- |awk 'BEGIN{RS=" ";rn=0}$0==e{rn=NR}END{print rn}' \
- e=${_flags_opt_}`
- _flags_name_=`echo "${__flags_longNames}" \
- |awk 'BEGIN{RS=" "}rn==NR{print $0}' rn="${_flags_pos_}"`
- fi
- ;;
- esac
-
- # die if the flag was unrecognized
- if [ -z "${_flags_name_}" ]; then
- flags_error="unrecognized option (${_flags_opt_})"
- flags_return=${FLAGS_ERROR}
- break
- fi
-
- # set new flag value
- _flags_usName_=`_flags_underscoreName ${_flags_name_}`
- [ ${_flags_type_} -eq ${__FLAGS_TYPE_NONE} ] && \
- _flags_type_=`_flags_getFlagInfo \
- "${_flags_usName_}" ${__FLAGS_INFO_TYPE}`
- case ${_flags_type_} in
- ${__FLAGS_TYPE_BOOLEAN})
- if [ ${_flags_len_} -eq ${__FLAGS_LEN_LONG} ]; then
- if [ "${_flags_arg_}" != "${__FLAGS_NULL}" ]; then
- eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}"
- else
- eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}"
- fi
- else
- _flags_strToEval_="_flags_val_=\
-\${__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}}"
- eval "${_flags_strToEval_}"
- if [ ${_flags_val_} -eq ${FLAGS_FALSE} ]; then
- eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}"
- else
- eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}"
- fi
- fi
- ;;
-
- ${__FLAGS_TYPE_FLOAT})
- if _flags_validFloat "${_flags_arg_}"; then
- eval "FLAGS_${_flags_usName_}='${_flags_arg_}'"
- else
- flags_error="invalid float value (${_flags_arg_})"
- flags_return=${FLAGS_ERROR}
- break
- fi
- ;;
-
- ${__FLAGS_TYPE_INTEGER})
- if _flags_validInt "${_flags_arg_}"; then
- eval "FLAGS_${_flags_usName_}='${_flags_arg_}'"
- else
- flags_error="invalid integer value (${_flags_arg_})"
- flags_return=${FLAGS_ERROR}
- break
- fi
- ;;
-
- ${__FLAGS_TYPE_STRING})
- eval "FLAGS_${_flags_usName_}='${_flags_arg_}'"
- ;;
- esac
-
- # handle special case help flag
- if [ "${_flags_usName_}" = 'help' ]; then
- if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then
- flags_help
- flags_error='help requested'
- flags_return=${FLAGS_TRUE}
- break
- fi
- fi
-
- # shift the option and non-boolean arguements out.
- shift
- [ ${_flags_type_} != ${__FLAGS_TYPE_BOOLEAN} ] && shift
- done
-
- # give user back non-flag arguments
- FLAGS_ARGV=''
- while [ $# -gt 0 ]; do
- FLAGS_ARGV="${FLAGS_ARGV:+${FLAGS_ARGV} }'$1'"
- shift
- done
-
- unset _flags_arg_ _flags_len_ _flags_name_ _flags_opt_ _flags_pos_ \
- _flags_strToEval_ _flags_type_ _flags_usName_ _flags_val_
- return ${flags_return}
-}
-
-# Perform some path using built-ins.
-#
-# Args:
-# $@: string: math expression to evaluate
-# Output:
-# integer: the result
-# Returns:
-# bool: success of math evaluation
-_flags_math()
-{
- if [ $# -eq 0 ]; then
- flags_return=${FLAGS_FALSE}
- elif _flags_useBuiltin; then
- # Variable assignment is needed as workaround for Solaris Bourne shell,
- # which cannot parse a bare $((expression)).
- _flags_expr_='$(($@))'
- eval echo ${_flags_expr_}
- flags_return=$?
- unset _flags_expr_
- else
- eval expr $@
- flags_return=$?
- fi
-
- return ${flags_return}
-}
-
-# Cross-platform strlen() implementation.
-#
-# Args:
-# _flags_str: string: to determine length of
-# Output:
-# integer: length of string
-# Returns:
-# bool: success of strlen evaluation
-_flags_strlen()
-{
- _flags_str_=${1:-}
-
- if [ -z "${_flags_str_}" ]; then
- flags_output=0
- elif _flags_useBuiltin; then
- flags_output=${#_flags_str_}
- else
- flags_output=`${FLAGS_EXPR_CMD} -- "${_flags_str_}" : '.*'`
- fi
- flags_return=$?
-
- unset _flags_str_
- echo ${flags_output}
- return ${flags_return}
-}
-
-# Use built-in helper function to enable unit testing.
-#
-# Args:
-# None
-# Returns:
-# bool: true if built-ins should be used
-_flags_useBuiltin()
-{
- return ${__FLAGS_USE_BUILTIN}
-}
-
-#------------------------------------------------------------------------------
-# public functions
-#
-# A basic boolean flag. Boolean flags do not take any arguments, and their
-# value is either 1 (false) or 0 (true). For long flags, the false value is
-# specified on the command line by prepending the word 'no'. With short flags,
-# the presense of the flag toggles the current value between true and false.
-# Specifying a short boolean flag twice on the command results in returning the
-# value back to the default value.
-#
-# A default value is required for boolean flags.
-#
-# For example, lets say a Boolean flag was created whose long name was 'update'
-# and whose short name was 'x', and the default value was 'false'. This flag
-# could be explicitly set to 'true' with '--update' or by '-x', and it could be
-# explicitly set to 'false' with '--noupdate'.
-DEFINE_boolean() { _flags_define ${__FLAGS_TYPE_BOOLEAN} "$@"; }
-
-# Other basic flags.
-DEFINE_float() { _flags_define ${__FLAGS_TYPE_FLOAT} "$@"; }
-DEFINE_integer() { _flags_define ${__FLAGS_TYPE_INTEGER} "$@"; }
-DEFINE_string() { _flags_define ${__FLAGS_TYPE_STRING} "$@"; }
-
-# Parse the flags.
-#
-# Args:
-# unnamed: list: command-line flags to parse
-# Returns:
-# integer: success of operation, or error
-FLAGS()
-{
- # define a standard 'help' flag if one isn't already defined
- [ -z "${__flags_help_type:-}" ] && \
- DEFINE_boolean 'help' false 'show this help' 'h'
-
- # parse options
- if [ $# -gt 0 ]; then
- if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then
- _flags_getoptStandard "$@"
- else
- _flags_getoptEnhanced "$@"
- fi
- flags_return=$?
- else
- # nothing passed; won't bother running getopt
- __flags_opts='--'
- flags_return=${FLAGS_TRUE}
- fi
-
- if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then
- _flags_parseGetopt $# "${__flags_opts}"
- flags_return=$?
- fi
-
- [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_fatal "${flags_error}"
- return ${flags_return}
-}
-
-# This is a helper function for determining the 'getopt' version for platforms
-# where the detection isn't working. It simply outputs debug information that
-# can be included in a bug report.
-#
-# Args:
-# none
-# Output:
-# debug info that can be included in a bug report
-# Returns:
-# nothing
-flags_getoptInfo()
-{
- # platform info
- _flags_debug "uname -a: `uname -a`"
- _flags_debug "PATH: ${PATH}"
-
- # shell info
- if [ -n "${BASH_VERSION:-}" ]; then
- _flags_debug 'shell: bash'
- _flags_debug "BASH_VERSION: ${BASH_VERSION}"
- elif [ -n "${ZSH_VERSION:-}" ]; then
- _flags_debug 'shell: zsh'
- _flags_debug "ZSH_VERSION: ${ZSH_VERSION}"
- fi
-
- # getopt info
- ${FLAGS_GETOPT_CMD} >/dev/null
- _flags_getoptReturn=$?
- _flags_debug "getopt return: ${_flags_getoptReturn}"
- _flags_debug "getopt --version: `${FLAGS_GETOPT_CMD} --version 2>&1`"
-
- unset _flags_getoptReturn
-}
-
-# Returns whether the detected getopt version is the enhanced version.
-#
-# Args:
-# none
-# Output:
-# none
-# Returns:
-# bool: true if getopt is the enhanced version
-flags_getoptIsEnh()
-{
- test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH}
-}
-
-# Returns whether the detected getopt version is the standard version.
-#
-# Args:
-# none
-# Returns:
-# bool: true if getopt is the standard version
-flags_getoptIsStd()
-{
- test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD}
-}
-
-# This is effectively a 'usage()' function. It prints usage information and
-# exits the program with ${FLAGS_FALSE} if it is ever found in the command line
-# arguments. Note this function can be overridden so other apps can define
-# their own --help flag, replacing this one, if they want.
-#
-# Args:
-# none
-# Returns:
-# integer: success of operation (always returns true)
-flags_help()
-{
- if [ -n "${FLAGS_HELP:-}" ]; then
- echo "${FLAGS_HELP}" >&2
- else
- echo "USAGE: ${FLAGS_PARENT:-$0} [flags] args" >&2
- fi
- if [ -n "${__flags_longNames}" ]; then
- echo 'flags:' >&2
- for flags_name_ in ${__flags_longNames}; do
- flags_flagStr_=''
- flags_boolStr_=''
- flags_usName_=`_flags_underscoreName ${flags_name_}`
-
- flags_default_=`_flags_getFlagInfo \
- "${flags_usName_}" ${__FLAGS_INFO_DEFAULT}`
- flags_help_=`_flags_getFlagInfo \
- "${flags_usName_}" ${__FLAGS_INFO_HELP}`
- flags_short_=`_flags_getFlagInfo \
- "${flags_usName_}" ${__FLAGS_INFO_SHORT}`
- flags_type_=`_flags_getFlagInfo \
- "${flags_usName_}" ${__FLAGS_INFO_TYPE}`
-
- [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \
- flags_flagStr_="-${flags_short_}"
-
- if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} ]; then
- [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \
- flags_flagStr_="${flags_flagStr_},"
- # add [no] to long boolean flag names, except the 'help' flag
- [ ${flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} \
- -a "${flags_usName_}" != 'help' ] && \
- flags_boolStr_='[no]'
- flags_flagStr_="${flags_flagStr_}--${flags_boolStr_}${flags_name_}:"
- fi
-
- case ${flags_type_} in
- ${__FLAGS_TYPE_BOOLEAN})
- if [ ${flags_default_} -eq ${FLAGS_TRUE} ]; then
- flags_defaultStr_='true'
- else
- flags_defaultStr_='false'
- fi
- ;;
- ${__FLAGS_TYPE_FLOAT}|${__FLAGS_TYPE_INTEGER})
- flags_defaultStr_=${flags_default_} ;;
- ${__FLAGS_TYPE_STRING}) flags_defaultStr_="'${flags_default_}'" ;;
- esac
- flags_defaultStr_="(default: ${flags_defaultStr_})"
-
- flags_helpStr_=" ${flags_flagStr_} ${flags_help_} ${flags_defaultStr_}"
- _flags_strlen "${flags_helpStr_}" >/dev/null
- flags_helpStrLen_=${flags_output}
- flags_columns_=`_flags_columns`
-
- if [ ${flags_helpStrLen_} -lt ${flags_columns_} ]; then
- echo "${flags_helpStr_}" >&2
- else
- echo " ${flags_flagStr_} ${flags_help_}" >&2
- # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
- # because it doesn't like empty strings when used in this manner.
- flags_emptyStr_="`echo \"x${flags_flagStr_}x\" \
- |awk '{printf "%"length($0)-2"s", ""}'`"
- flags_helpStr_=" ${flags_emptyStr_} ${flags_defaultStr_}"
- _flags_strlen "${flags_helpStr_}" >/dev/null
- flags_helpStrLen_=${flags_output}
-
- if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} \
- -o ${flags_helpStrLen_} -lt ${flags_columns_} ]; then
- # indented to match help string
- echo "${flags_helpStr_}" >&2
- else
- # indented four from left to allow for longer defaults as long flag
- # names might be used too, making things too long
- echo " ${flags_defaultStr_}" >&2
- fi
- fi
- done
- fi
-
- unset flags_boolStr_ flags_default_ flags_defaultStr_ flags_emptyStr_ \
- flags_flagStr_ flags_help_ flags_helpStr flags_helpStrLen flags_name_ \
- flags_columns_ flags_short_ flags_type_ flags_usName_
- return ${FLAGS_TRUE}
-}
-
-# Reset shflags back to an uninitialized state.
-#
-# Args:
-# none
-# Returns:
-# nothing
-flags_reset()
-{
- for flags_name_ in ${__flags_longNames}; do
- flags_usName_=`_flags_underscoreName ${flags_name_}`
- flags_strToEval_="unset FLAGS_${flags_usName_}"
- for flags_type_ in \
- ${__FLAGS_INFO_DEFAULT} \
- ${__FLAGS_INFO_HELP} \
- ${__FLAGS_INFO_SHORT} \
- ${__FLAGS_INFO_TYPE}
- do
- flags_strToEval_=\
-"${flags_strToEval_} __flags_${flags_usName_}_${flags_type_}"
- done
- eval ${flags_strToEval_}
- done
-
- # reset internal variables
- __flags_boolNames=' '
- __flags_longNames=' '
- __flags_shortNames=' '
- __flags_definedNames=' '
-
- unset flags_name_ flags_type_ flags_strToEval_ flags_usName_
-}
diff --git a/src/shflags_test.sh b/src/shflags_test.sh
deleted file mode 100755
index 18ca961..0000000
--- a/src/shflags_test.sh
+++ /dev/null
@@ -1,116 +0,0 @@
-#! /bin/sh
-# vim:et:ft=sh:sts=2:sw=2
-#
-# shFlags unit test suite runner.
-#
-# This script runs all the unit tests that can be found, and generates a nice
-# report of the tests.
-
-MY_NAME=`basename $0`
-MY_PATH=`dirname $0`
-
-PREFIX='shflags_test_'
-SHELLS='/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh'
-TESTS=''
-for test in ${PREFIX}[a-z]*.sh; do
- TESTS="${TESTS} ${test}"
-done
-
-# load libraries
-. ../lib/versions
-. ./shflags_test_helpers
-
-usage()
-{
- echo "usage: ${MY_NAME} [-e key=val ...] [-s shell(s)] [-t test(s)]"
-}
-
-env=''
-
-# process command line flags
-while getopts 'e:hs:t:' opt; do
- case ${opt} in
- e) # set an environment variable
- key=`expr "${OPTARG}" : '\([^=]*\)='`
- val=`expr "${OPTARG}" : '[^=]*=\(.*\)'`
- if [ -z "${key}" -o -z "${val}" ]; then
- usage
- exit 1
- fi
- eval "${key}='${val}'"
- export ${key}
- env="${env:+${env} }${key}"
- ;;
- h) usage; exit 0 ;; # help output
- s) shells=${OPTARG} ;; # list of shells to run
- t) tests=${OPTARG} ;; # list of tests to run
- *) usage; exit 1 ;;
- esac
-done
-shift `expr ${OPTIND} - 1`
-
-# fill shells and/or tests
-shells=${shells:-${SHELLS}}
-tests=${tests:-${TESTS}}
-
-# error checking
-if [ -z "${tests}" ]; then
- th_error 'no tests found to run; exiting'
- exit 1
-fi
-
-cat <<EOF
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="${shells}"
-tests="${tests}"
-EOF
-for key in ${env}; do
- eval "echo \"${key}=\$${key}\""
-done
-echo
-
-# output system data
-echo "# system info"
-echo "$ date"
-date
-
-echo "$ uname -mprsv"
-uname -mprsv
-
-#
-# run tests
-#
-
-for shell in ${shells}; do
- echo
-
- cat <<EOF
-
-#------------------------------------------------------------------------------
-# Running the test suite with ${shell}
-#
-EOF
- # check for existance of shell
- if [ ! -x ${shell} ]; then
- th_warn "unable to run tests with the ${shell} shell"
- continue
- fi
-
- shell_name=`basename ${shell}`
- shell_version=`versions_shellVersion "${shell}"`
-
- echo "shell name: ${shell_name}"
- echo "shell version: ${shell_version}"
-
- # execute the tests
- for suite in ${tests}; do
- suiteName=`expr "${suite}" : "${PREFIX}\(.*\).sh"`
- echo
- echo "--- Executing the '${suiteName}' test suite ---"
- ( exec ${shell} ./${suite} 2>&1; )
- done
-done
diff --git a/src/shflags_test_defines.sh b/src/shflags_test_defines.sh
deleted file mode 100755
index 1f76c3e..0000000
--- a/src/shflags_test_defines.sh
+++ /dev/null
@@ -1,217 +0,0 @@
-#! /bin/sh
-# vim:et:ft=sh:sts=2:sw=2
-#
-# shFlags unit test for the flag definition methods
-
-# load test helpers
-. ./shflags_test_helpers
-
-#------------------------------------------------------------------------------
-# suite tests
-#
-
-testFlagsDefine()
-{
- # no arguments
- _flags_define >"${stdoutF}" 2>"${stderrF}"
- assertFalse '_flags_define() with no arguments should have failed.' $?
- assertErrorMsg '' 'no arguments'
-
- # one argument
- _flags_define arg1 >"${stdoutF}" 2>"${stderrF}"
- assertFalse '_flags_define() call with one argument should fail' $?
- assertErrorMsg '' 'one argument'
-
- # two arguments
- _flags_define arg1 arg2 >"${stdoutF}" 2>"${stderrF}"
- assertFalse '_flags_define() call with two arguments should fail' $?
- assertErrorMsg '' 'two arguments'
-
- # three arguments
- _flags_define arg1 arg2 arg3 >"${stdoutF}" 2>"${stderrF}"
- assertFalse '_flags_define() call with three arguments should fail' $?
- assertErrorMsg '' 'three arguments'
-
- # multiple definition -- assumes working boolean definition (tested elsewhere)
- _flags_define ${__FLAGS_TYPE_BOOLEAN} multiDefBool true 'multi def #1' m
- _flags_define ${__FLAGS_TYPE_BOOLEAN} multiDefBool false 'multi def #2' m \
- >"${stdoutF}" 2>"${stderrF}"
- assertFalse '_flags_define() with existing flag name should fail' $?
- assertTrue \
- '_flags_define() should not overwrite previously defined default.' \
- "${FLAGS_multiDefBool:-}"
- assertWarnMsg '' 'existing flag'
-
- # duplicate dashed and underscored definition
- _flags_define ${__FLAGS_TYPE_STRING} long-name 'foo' 'dashed name' l
- _flags_define ${__FLAGS_TYPE_STRING} long_name 'bar' 'underscored name' l \
- >"${stdoutF}" 2>"${stderrF}"
- assertFalse '_flags_define() with existing flag name should fail' $?
- assertEquals \
- '_flags_define() should not overwrite previously defined default.' \
- "${FLAGS_long_name}" 'foo'
- assertWarnMsg '' 'already exists'
-
- # TODO(kward): test requirement of enhanced getopt
-
- # invalid type
- _flags_define invalid arg2 arg3 arg4 i >"${stdoutF}" 2>"${stderrF}"
- assertFalse '_flags_define() with "invalid" type should have failed.' $?
- assertErrorMsg 'unrecognized flag type' 'invalid type'
-}
-
-testBoolean()
-{
- # test true defaults
- for default in 'true' 't' 0; do
- flags_reset
- DEFINE_boolean boolVal "${default}" 'my boolean' b
- rtrn=$?
- assertTrue \
- "DEFINE_boolean() call with default of '${default}' failed." \
- "${FLAGS_boolVal:-}"
- assertTrue \
- "DEFINE_boolean() call with default of '${default}' returned faliure." \
- ${rtrn}
- done
-
- # test false defaults
- for default in 'false' 'f' 1; do
- flags_reset
- DEFINE_boolean boolVal "${default}" 'my boolean' b
- rtrn=$?
- assertFalse \
- "DEFINE_boolean() call with default of '${default}' failed." \
- "${FLAGS_boolVal:-}"
- assertTrue \
- "DEFINE_boolean() call with default of '${default}' returned faliure." \
- ${rtrn}
- done
-
- # test invalid default
- flags_reset
- DEFINE_boolean boolVal 'invalid' 'my boolean' b >"${stdoutF}" 2>"${stderrF}"
- assertFalse 'DEFINE_boolean() call with invalid default did not fail.' $?
- assertErrorMsg
-}
-
-testFloat()
-{
- # test valid defaults
- for default in ${TH_FLOAT_VALID}; do
- flags_reset
- DEFINE_float floatVal ${default} "float: ${default}" f
- rtrn=$?
- assertSame "DEFINE_float() call with valid default failed." \
- ${default} "${FLAGS_floatVal:-}"
- assertTrue \
- "DEFINE_float() call with valid default of '${default}' returned faliure." \
- ${rtrn}
- done
-
- # test invalid defaults
- flags_reset
- DEFINE_float floatVal 'invalid' 'invalid float: string' f \
- >"${stdoutF}" 2>"${stderrF}"
- assertFalse 'DEFINE_float() call with string value default did not fail.' $?
- assertErrorMsg
-}
-
-testInteger()
-{
- # test valid defaults
- for default in ${TH_INT_VALID}; do
- flags_reset
- DEFINE_integer intVal ${default} "integer: ${default}" i
- rtrn=$?
- assertSame \
- "DEFINE_integer() call with valid default failed." \
- ${default} "${FLAGS_intVal:-}"
- assertTrue \
- "DEFINE_integer() call with valid default of '${default}' returned failure." \
- ${rtrn}
- done
-
- # test invalid defaults
- flags_reset
- DEFINE_integer intVal 1.234 'invalid integer: float' i \
- >"${stdoutF}" 2>"${stderrF}"
- assertFalse 'DEFINE_integer() call with float value default did not fail.' $?
- assertErrorMsg 'invalid default' 'float default'
-
- DEFINE_integer intVal -1.234 'invalid integer: negative float' i \
- >"${stdoutF}" 2>"${stderrF}"
- assertFalse \
- 'DEFINE_integer() call with negative float value default did not fail.' \
- $?
- assertErrorMsg 'invalid default' 'negative float default'
-
- DEFINE_integer intVal 'invalid' 'invalid integer: string' i \
- >"${stdoutF}" 2>"${stderrF}"
- assertFalse \
- 'DEFINE_integer() call with string value default did not fail.' \
- $?
- assertErrorMsg 'invalid default' 'string default'
-}
-
-testString()
-{
- # test valid defaults
- for default in \
- ${TH_BOOL_VALID} \
- ${TH_FLOAT_VALID} \
- ${TH_INT_VALID} \
- 'also valid'
- do
- flags_reset
- DEFINE_string strVal "${default}" "string: ${default}" s
- rtrn=$?
- assertSame \
- "DEFINE_string() call with valid default failed." \
- "${default}" "${FLAGS_strVal:-}"
- assertTrue \
- "DEFINE_string() call with valid default of '${default}' returned faliure." \
- ${rtrn}
- done
-
- # test "empty" strings
- flags_reset
- DEFINE_string str '' "string: empty single quotes" s
- rtrn=$?
- assertSame \
- "DEFINE_string() call with valid default failed." \
- '' "${FLAGS_str:-}"
-}
-
-testShortNameLength()
-{
- # make sure short names are no longer than a single character
- :
-}
-
-testFlagNameIsReserved()
-{
- ( DEFINE_string TRUE '' 'true is a reserved flag name' t \
- >"${stdoutF}" 2>"${stderrF}" )
- rtrn=$?
- assertEquals ${FLAGS_ERROR} ${rtrn}
- assertErrorMsg 'flag name (TRUE) is reserved'
-}
-
-#------------------------------------------------------------------------------
-# suite functions
-#
-
-oneTimeSetUp()
-{
- th_oneTimeSetUp
-}
-
-tearDown()
-{
- flags_reset
-}
-
-# load and run shUnit2
-[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
-. ${TH_SHUNIT}
diff --git a/src/shflags_test_helpers b/src/shflags_test_helpers
deleted file mode 100644
index d00f31e..0000000
--- a/src/shflags_test_helpers
+++ /dev/null
@@ -1,116 +0,0 @@
-# vim:et:ft=sh:sts=2:sw=2
-#
-# shFlags unit test common functions
-
-__th_skipping=0
-
-# treat unset variables as an error
-set -u
-
-# set shwordsplit for zsh
-[ -n "${ZSH_VERSION:-}" ] && setopt shwordsplit
-
-# my name
-TH_MY_NAME=`basename "$0"`
-
-# path to shFlags library. can be overridden by setting SHFLAGS_INC
-TH_SHFLAGS=${SHFLAGS_INC:-./shflags}
-
-# path to shUnit2 library. can be overridden by setting SHUNIT_INC
-TH_SHUNIT=${SHUNIT_INC:-../lib/shunit2}
-
-TH_BOOL_VALID='true t 0 false f 1'
-TH_BOOL_INVALID='123 123.0 invalid'
-TH_FLOAT_VALID='-1234.0 -1.0 -.123 0.0 0. .123 1.0 1234.0'
-TH_FLOAT_INVALID='true false 1.2.3 -1.2.3 ""'
-TH_INT_VALID='-1234 -1 0 1 1234'
-TH_INT_INVALID='true false -1.0 -.123 0.0 .123 1.0 ""'
-
-#
-# test helper functions
-#
-
-# message functions
-th_trace() { echo "test:TRACE $@" >&2; }
-th_debug() { echo "test:DEBUG $@" >&2; }
-th_info() { echo "test:INFO $@" >&2; }
-th_warn() { echo "test:WARN $@" >&2; }
-th_error() { echo "test:ERROR $@" >&2; }
-th_fatal() { echo "test:FATAL $@" >&2; }
-
-th_oneTimeSetUp()
-{
- # load shFlags
- [ -n "${ZSH_VERSION:-}" ] && FLAGS_PARENT=$0
- . ${TH_SHFLAGS}
-
- # these files will be cleaned up automatically by shUnit2
- tmpDir=${SHUNIT_TMPDIR}
- stdoutF="${tmpDir}/stdout"
- stderrF="${tmpDir}/stderr"
- returnF="${tmpDir}/return"
- expectedF="${tmpDir}/expected"
-}
-
-th_showOutput()
-{
- _th_rtrn=$1
- _th_stdout=$2
- _th_stderr=$3
-
- isSkipping
- if [ $? -eq ${SHUNIT_FALSE} -a ${_th_rtrn} != ${FLAGS_TRUE} ]; then
- if [ -n "${_th_stdout}" -a -s "${_th_stdout}" ]; then
- echo '>>> STDOUT' >&2
- cat "${_th_stdout}" >&2
- fi
- if [ -n "${_th_stderr}" -a -s "${_th_stderr}" ]; then
- echo '>>> STDERR' >&2
- cat "${_th_stderr}" >&2
- fi
- if [ -n "${_th_stdout}" -o -n "${_th_stderr}" ]; then
- echo '<<< end output' >&2
- fi
- fi
-
- unset _th_rtrn _th_stdout _th_stderr
-}
-
-# Some shells, zsh on Solaris in particular, return immediately from a sub-shell
-# when a non-zero return value is encountered. To properly catch these values,
-# they are either written to disk, or recognized as an error the file is empty.
-th_clearReturn() { cp /dev/null "${returnF}"; }
-th_queryReturn()
-{
- if [ -s "${returnF}" ]; then
- th_return=`cat "${returnF}"`
- else
- th_return=${SHUNIT_ERROR}
- fi
-}
-
-_th_assertMsg()
-{
- _th_alert_type_=$1
- _th_alert_msg_=$2
- _th_msg_=$3
-
- case ${_th_alert_type_} in
- WARN) _th_alert_str_='a warning' ;;
- ERROR) _th_alert_str_='an error' ;;
- FATAL) _th_alert_str_='a fatal' ;;
- esac
- [ -z "${_th_alert_msg_}" ] && _th_alert_msg_='.*'
- [ -n "${_th_msg_}" ] && _th_msg_="(${_th_msg_}) "
-
- grep -- "^flags:${_th_alert_type_} ${_th_alert_msg_}" "${stderrF}" \
- >/dev/null
- assertTrue \
- "FLAGS ${_th_msg_}failure did not generate ${_th_alert_str_} message" $?
-
- unset _th_alert_type_ _th_alert_msg_ _th_alert_str_ _th_msg_
-}
-
-assertWarnMsg() { _th_assertMsg 'WARN' "${1:-}" "${2:-}"; }
-assertErrorMsg() { _th_assertMsg 'ERROR' "${1:-}" "${2:-}"; }
-assertFatalMsg() { _th_assertMsg 'FATAL' "${1:-}" "${2:-}"; }
diff --git a/src/shflags_test_parsing.sh b/src/shflags_test_parsing.sh
deleted file mode 100755
index d79a042..0000000
--- a/src/shflags_test_parsing.sh
+++ /dev/null
@@ -1,365 +0,0 @@
-#! /bin/sh
-# vim:et:ft=sh:sts=2:sw=2
-#
-# shFlags unit test for the flag definition methods
-#
-# TODO(kward): assert on FLAGS errors
-# TODO(kward): testNonStandardIFS()
-
-# exit immediately if a pipeline or subshell exits with a non-zero status.
-#set -e
-
-# treat unset variables as an error
-set -u
-
-# load test helpers
-. ./shflags_test_helpers
-
-#------------------------------------------------------------------------------
-# suite tests
-#
-
-testGetoptStandard()
-{
- _flags_getoptStandard '-b' >"${stdoutF}" 2>"${stderrF}"
- rslt=$?
- assertTrue "didn't parse valid flag 'b'" ${rslt}
- th_showOutput ${rslt} "${stdoutF}" "${stderrF}"
-
- _flags_getoptStandard '-x' >"${stdoutF}" 2>"${stderrF}"
- assertFalse "parsed invalid flag 'x'" $?
-}
-
-testGetoptEnhanced()
-{
- flags_getoptIsEnh || return
-
- _flags_getoptEnhanced '-b' >"${stdoutF}" 2>"${stderrF}"
- assertTrue "didn't parse valid flag 'b'" $?
- _flags_getoptEnhanced '--bool' >"${stdoutF}" 2>"${stderrF}"
- assertTrue "didn't parse valid flag 'bool'" $?
-
- _flags_getoptEnhanced '-x' >"${stdoutF}" 2>"${stderrF}"
- assertFalse "parsed invalid flag 'x'" $?
- _flags_getoptEnhanced '--xyz' >"${stdoutF}" 2>"${stderrF}"
- assertFalse "parsed invalid flag 'xyz'" $?
-}
-
-testValidBoolsShort()
-{
- FLAGS -b >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "-b) FLAGS returned a non-zero result (${r3turn})" ${r3turn}
- value=${FLAGS_bool:-}
- assertTrue "-b) boolean was not true (${value})." "${value}"
- assertFalse '-b) expected no output to STDERR' "[ -s '${stderrF}' ]"
- test ${r3turn} -eq ${FLAGS_TRUE} -a ! -s "${stderrF}"
- th_showOutput $? "${stdoutF}" "${stderrF}"
-
- DEFINE_boolean bool2 true '2nd boolean' B
- FLAGS >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "-B) FLAGS returned a non-zero result (${r3turn})" ${r3turn}
- value=${FLAGS_bool2:-}
- assertTrue "-B) boolean was not true (${value})" ${value}
- assertFalse '-B) expected no output to STDERR' "[ -s '${stderrF}' ]"
- test ${r3turn} -eq ${FLAGS_TRUE} -a ! -s "${stderrF}"
- th_showOutput $? "${stdoutF}" "${stderrF}"
-
- FLAGS -B >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "-B) FLAGS returned a non-zero result (${r3turn})" ${r3turn}
- value=${FLAGS_bool2:-}
- assertFalse "-B) boolean was not false (${value})" ${value}
- assertFalse '-B) expected no output to STDERR' "[ -s '${stderrF}' ]"
- test ${r3turn} -eq ${FLAGS_TRUE} -a ! -s "${stderrF}"
- th_showOutput $? "${stdoutF}" "${stderrF}"
-}
-
-# TODO(kate): separate into multiple functions to reflect correct usage
-testValidBoolsLong()
-{
- flags_getoptIsEnh || return
-
- # Note: the default value of bool is 'false'.
-
- # leave flag false
- FLAGS --nobool >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn}
- assertFalse '--noXX flag resulted in true value.' ${FLAGS_bool:-}
- assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-
- # flip flag true
- FLAGS --bool >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn}
- assertTrue '--XX flag resulted in false value.' ${FLAGS_bool:-}
- assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-
- # flip flag back false
- FLAGS --nobool >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn}
- assertFalse '--noXX flag resulted in true value.' ${FLAGS_bool:-}
- assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-}
-
-testValidFloats()
-{
- _testValidFloats '-f'
- flags_getoptIsEnh || return
- _testValidFloats '--float'
-}
-
-_testValidFloats()
-{
- flag=$1
- for value in ${TH_FLOAT_VALID}; do
- FLAGS ${flag} ${value} >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "FLAGS ${flag} ${value} returned non-zero result (${r3turn})" \
- ${r3turn}
- assertEquals "float (${flag} ${value}) test failed." ${value} ${FLAGS_float}
- assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
- done
-}
-
-testInvalidFloats()
-{
- _testInvalidFloats '-f'
- flags_getoptIsEnh || return
- _testInvalidFloats '--float'
-}
-
-_testInvalidFloats()
-{
- flag=$1
- for value in ${TH_FLOAT_INVALID}; do
- th_clearReturn
- (
- FLAGS ${flag} ${value} >"${stdoutF}" 2>"${stderrF}"
- echo $? >"${returnF}"
- )
- th_queryReturn
- assertFalse "FLAGS (${value}) returned a zero result" ${th_return}
- assertFalse 'expected no output to STDOUT' "[ -s '${stdoutF}' ]"
- assertTrue 'expected output to STDERR' "[ -s '${stderrF}' ]"
- done
-}
-
-testValidIntegers()
-{
- _testValidIntegers '-i'
- flags_getoptIsEnh || return
- _testValidIntegers '--int'
-}
-
-_testValidIntegers()
-{
- flag=$1
- for value in ${TH_INT_VALID}; do
- FLAGS ${flag} ${value} >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "FLAGS (${value}) returned a non-zero result (${r3turn})" ${r3turn}
- assertEquals "integer (${value}) test failed." ${value} ${FLAGS_int}
- assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
- done
-}
-
-testInvalidIntegers()
-{
- _testInvalidIntegers '-i'
- flags_getoptIsEnh || return
- _testInvalidIntegers '--int'
-}
-
-_testInvalidIntegers()
-{
- flag=$1
- for value in ${TH_INT_INVALID}; do
- th_clearReturn
- (
- FLAGS ${flag} ${value} >"${stdoutF}" 2>"${stderrF}"
- echo $? >"${returnF}"
- )
- th_queryReturn
- assertFalse "invalid integer (${value}) test returned success." ${th_return}
- assertFalse 'expected no output to STDOUT' "[ -s '${stdoutF}' ]"
- assertTrue 'expected output to STDERR' "[ -s '${stderrF}' ]"
- done
-}
-
-testValidStrings()
-{
- _testValidStrings -s single_word
- if flags_getoptIsEnh; then
- _testValidStrings --str single_word
- _testValidStrings --str 'string with spaces'
- fi
-}
-
-_testValidStrings()
-{
- flag=$1
- value=$2
-
- FLAGS ${flag} "${value}" >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "'FLAGS ${flag} ${value}' returned a non-zero result (${r3turn})" \
- ${r3turn}
- assertEquals "string (${value}) test failed." "${value}" "${FLAGS_str}"
- if [ ${r3turn} -eq ${FLAGS_TRUE} ]; then
- assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
- else
- # validate that an error is thrown for unsupported getopt uses
- assertFatalMsg '.* spaces in options'
- fi
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-}
-
-testMultipleFlags()
-{
- _testMultipleFlags '-b' '-i' '-f' '-s'
- flags_getoptIsEnh || return
- _testMultipleFlags '--bool' '--int' '--float' '--str'
-}
-
-_testMultipleFlags()
-{
- boolFlag=$1
- intFlag=$2
- floatFlag=$3
- strFlag=$4
-
- FLAGS \
- ${boolFlag} \
- ${intFlag} 567 \
- ${floatFlag} 123.45678 \
- ${strFlag} 'some_string' \
- >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue "use of multple flags returned a non-zero result" ${r3turn}
- assertTrue 'boolean test failed.' ${FLAGS_bool}
- assertNotSame 'float test failed.' 0 ${FLAGS_float}
- assertNotSame 'integer test failed.' 0 ${FLAGS_int}
- assertNotSame 'string test failed.' '' ${FLAGS_str}
- assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-}
-
-_testNonFlagArgs()
-{
- argc=$1
- shift
-
- FLAGS "$@" >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue 'parse returned non-zero value.' ${r3turn}
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-
- eval set -- "${FLAGS_ARGV}"
- assertEquals 'wrong count of argv arguments returned.' ${argc} $#
- assertEquals 'wrong count of argc arguments returned.' 0 ${FLAGS_ARGC}
-}
-
-testSingleNonFlagArg()
-{
- _testNonFlagArgs 1 argOne
-}
-
-testMultipleNonFlagArgs()
-{
- _testNonFlagArgs 3 argOne argTwo arg3
-}
-
-testMultipleNonFlagStringArgsWithSpaces()
-{
- flags_getoptIsEnh || return
- _testNonFlagArgs 3 argOne 'arg two' arg3
-}
-
-testFlagsWithEquals()
-{
- flags_getoptIsEnh || return
-
- FLAGS --str='str_flag' 'non_flag' >"${stdoutF}" 2>"${stderrF}"
- assertTrue 'FLAGS returned a non-zero result' $?
- assertEquals 'string flag not set properly' 'str_flag' "${FLAGS_str}"
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-
- eval set -- "${FLAGS_ARGV}"
- assertEquals 'wrong count of argv arguments returned.' 1 $#
- assertEquals 'wrong count of argc arguments returned.' 1 ${FLAGS_ARGC}
-}
-
-testComplicatedCommandLineStandard()
-{
- flags_getoptIsEnh && return
-
- # Note: standard getopt stops parsing after first non-flag argument, which
- # results in the remaining flags being treated as arguments instead.
- FLAGS -i 1 non_flag_1 -s 'two' non_flag_2 -f 3 non_flag_3 \
- >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue 'FLAGS returned a non-zero result' ${r3turn}
- assertEquals 'failed int test' 1 ${FLAGS_int}
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-
- eval set -- "${FLAGS_ARGV}"
- assertEquals 'incorrect number of argv values' 7 $#
-}
-
-testComplicatedCommandLineEnhanced()
-{
- flags_getoptIsEnh || return
-
- FLAGS -i 1 non_flag_1 --str='two' non_flag_2 --float 3 'non flag 3' \
- >"${stdoutF}" 2>"${stderrF}"
- r3turn=$?
- assertTrue 'FLAGS returned a non-zero result' ${r3turn}
- assertEquals 'failed int test' 1 ${FLAGS_int}
- assertEquals 'failed str test' 'two' "${FLAGS_str}"
- assertEquals 'failed float test' 3 ${FLAGS_float}
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-
- eval set -- "${FLAGS_ARGV}"
- assertEquals 'incorrect number of argv values' 3 $#
-}
-
-#------------------------------------------------------------------------------
-# suite functions
-#
-
-oneTimeSetUp()
-{
- th_oneTimeSetUp
-
- if flags_getoptIsStd; then
- th_warn 'Standard version of getopt found. Enhanced tests will be skipped.'
- else
- th_warn 'Enhanced version of getopt found. Standard tests will be skipped.'
- fi
-}
-
-setUp()
-{
- DEFINE_boolean bool false 'boolean test' 'b'
- DEFINE_float float 0.0 'float test' 'f'
- DEFINE_integer int 0 'integer test' 'i'
- DEFINE_string str '' 'string test' 's'
-}
-
-tearDown()
-{
- flags_reset
-}
-
-# load and run shUnit2
-[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
-. ${TH_SHUNIT}
diff --git a/src/shflags_test_private.sh b/src/shflags_test_private.sh
deleted file mode 100755
index c252d42..0000000
--- a/src/shflags_test_private.sh
+++ /dev/null
@@ -1,247 +0,0 @@
-#! /bin/sh
-# vim:et:ft=sh:sts=2:sw=2
-#
-# shFlags unit test for the internal functions
-
-# load test helpers
-. ./shflags_test_helpers
-
-#------------------------------------------------------------------------------
-# suite tests
-#
-
-testColumns()
-{
- cols=`_flags_columns`
- value=`expr "${cols}" : '\([0-9]*\)'`
- assertNotNull "unexpected screen width (${cols})" "${value}"
-}
-
-testGenOptStr()
-{
- _testGenOptStr '' ''
-
- DEFINE_boolean bool false 'boolean value' b
- _testGenOptStr 'b' 'bool'
-
- DEFINE_float float 0.0 'float value' f
- _testGenOptStr 'bf:' 'bool,float:'
-
- DEFINE_integer int 0 'integer value' i
- _testGenOptStr 'bf:i:' 'bool,float:,int:'
-
- DEFINE_string str 0 'string value' s
- _testGenOptStr 'bf:i:s:' 'bool,float:,int:,str:'
-
- DEFINE_boolean help false 'show help' h
- _testGenOptStr 'bf:i:s:h' 'bool,float:,int:,str:,help'
-}
-
-_testGenOptStr()
-{
- short=$1
- long=$2
-
- result=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}`
- assertTrue 'short option string generation failed' $?
- assertEquals "${short}" "${result}"
-
- result=`_flags_genOptStr ${__FLAGS_OPTSTR_LONG}`
- assertTrue 'long option string generation failed' $?
- assertEquals "${long}" "${result}"
-}
-
-testGetFlagInfo()
-{
- __flags_blah_foobar='1234'
-
- rslt=`_flags_getFlagInfo 'blah' 'foobar'`
- assertTrue 'request for valid flag info failed' $?
- assertEquals 'invalid flag info returned' "${__flags_blah_foobar}" "${rslt}"
-
- rslt=`_flags_getFlagInfo 'blah' 'hubbabubba' >"${stdoutF}" 2>"${stderrF}"`
- assertEquals 'invalid flag did not result in an error' ${FLAGS_ERROR} $?
- assertErrorMsg 'missing flag info variable'
-}
-
-testItemInList()
-{
- list='this is a test'
-
- _flags_itemInList 'is' ${list}
- assertTrue 'unable to find leading string (this)' $?
-
- _flags_itemInList 'is' ${list}
- assertTrue 'unable to find string (is)' $?
-
- _flags_itemInList 'is' ${list}
- assertTrue 'unable to find trailing string (test)' $?
-
- _flags_itemInList 'abc' ${list}
- assertFalse 'found nonexistant string (abc)' $?
-
- _flags_itemInList '' ${list}
- assertFalse 'empty strings should not match' $?
-
- _flags_itemInList 'blah' ''
- assertFalse 'empty lists should not match' $?
-}
-
-testValidBool()
-{
- # valid values
- for value in ${TH_BOOL_VALID}; do
- _flags_validBool "${value}"
- assertTrue "valid value (${value}) did not validate" $?
- done
-
- # invalid values
- for value in ${TH_BOOL_INVALID}; do
- _flags_validBool "${value}"
- assertFalse "invalid value (${value}) validated" $?
- done
-}
-
-_testValidFloat()
-{
- # valid values
- for value in ${TH_INT_VALID} ${TH_FLOAT_VALID}; do
- _flags_validFloat "${value}"
- assertTrue "valid value (${value}) did not validate" $?
- done
-
- # invalid values
- for value in ${TH_FLOAT_INVALID}; do
- _flags_validFloat "${value}"
- assertFalse "invalid value (${value}) validated" $?
- done
-}
-
-testValidFloatBuiltin()
-{
- _flags_useBuiltin || startSkipping
- _testValidFloat
-}
-
-testValidFloatExpr()
-{
- (
- _flags_useBuiltin() { return ${FLAGS_FALSE}; }
- _testValidFloat
- )
-}
-
-_testValidInt()
-{
- # valid values
- for value in ${TH_INT_VALID}; do
- _flags_validInt "${value}"
- assertTrue "valid value (${value}) did not validate" $?
- done
-
- # invalid values
- for value in ${TH_INT_INVALID}; do
- _flags_validInt "${value}"
- assertFalse "invalid value (${value}) should not validate" $?
- done
-}
-
-testValidIntBuiltin()
-{
- _flags_useBuiltin || startSkipping
- _testValidInt
-}
-
-testValidIntExpr()
-{
- (
- _flags_useBuiltin() { return ${FLAGS_FALSE}; }
- _testValidInt
- )
-}
-
-_testMath()
-{
- result=`_flags_math 1`
- assertTrue '1 failed' $?
- assertEquals '1' 1 ${result}
-
- result=`_flags_math '1 + 2'`
- assertTrue '1+2 failed' $?
- assertEquals '1+2' 3 ${result}
-
- result=`_flags_math '1 + 2 + 3'`
- assertTrue '1+2+3 failed' $?
- assertEquals '1+2+3' 6 ${result}
-
- result=`_flags_math`
- assertFalse 'missing math succeeded' $?
-}
-
-testMathBuiltin()
-{
- _flags_useBuiltin || startSkipping
- _testMath
-}
-
-testMathExpr()
-{
- (
- _flags_useBuiltin() { return ${FLAGS_FALSE}; }
- _testMath
- )
-}
-
-_testStrlen()
-{
- len=`_flags_strlen`
- assertTrue 'missing argument failed' $?
- assertEquals 'missing argument' 0 ${len}
-
- len=`_flags_strlen ''`
- assertTrue 'empty argument failed' $?
- assertEquals 'empty argument' 0 ${len}
-
- len=`_flags_strlen abc123`
- assertTrue 'single-word failed' $?
- assertEquals 'single-word' 6 ${len}
-
- len=`_flags_strlen 'This is a test'`
- assertTrue 'multi-word failed' $?
- assertEquals 'multi-word' 14 ${len}
-}
-
-testStrlenBuiltin()
-{
- _flags_useBuiltin || startSkipping
- _testStrlen
-}
-
-testStrlenExpr()
-{
- (
- _flags_useBuiltin() { return ${FLAGS_FALSE}; }
- _testStrlen
- )
-}
-
-#------------------------------------------------------------------------------
-# suite functions
-#
-
-oneTimeSetUp()
-{
- th_oneTimeSetUp
-
- _flags_useBuiltin || \
- th_warn 'Shell built-ins not supported. Some tests will be skipped.'
-}
-
-tearDown()
-{
- flags_reset
-}
-
-# load and run shUnit2
-[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
-. ${TH_SHUNIT}
diff --git a/src/shflags_test_public.sh b/src/shflags_test_public.sh
deleted file mode 100755
index 5efb43e..0000000
--- a/src/shflags_test_public.sh
+++ /dev/null
@@ -1,180 +0,0 @@
-#! /bin/sh
-# vim:et:ft=sh:sts=2:sw=2
-#
-# shFlags unit test for the public functions
-
-# load test helpers
-. ./shflags_test_helpers
-
-#------------------------------------------------------------------------------
-# suite tests
-#
-
-testHelp()
-{
- _testHelp '-h'
- flags_getoptIsEnh || return
- _testHelp '--help'
-}
-
-_testHelp()
-{
- flag=$1
-
- # test default help output
- th_clearReturn
- (
- FLAGS ${flag} >"${stdoutF}" 2>"${stderrF}"
- echo $? >"${returnF}"
- )
- th_queryReturn
- assertTrue \
- 'short help request should have returned a true exit code.' \
- ${th_return}
- grep 'show this help' "${stderrF}" >/dev/null
- grepped=$?
- assertTrue \
- 'short request for help should have produced some help output.' \
- ${grepped}
- [ ${grepped} -ne ${FLAGS_TRUE} ] && th_showOutput
-
- # test proper output when FLAGS_HELP set
- (
- FLAGS_HELP='this is a test'
- FLAGS ${flag} >"${stdoutF}" 2>"${stderrF}"
- )
- grep 'this is a test' "${stderrF}" >/dev/null
- grepped=$?
- assertTrue 'setting FLAGS_HELP did not produce expected result' ${grepped}
- [ ${grepped} -ne ${FLAGS_TRUE} ] && th_showOutput
-
- # test that "'" chars work in help string
- (
- DEFINE_boolean b false "help string containing a ' char" b
- FLAGS ${flag} >"${stdoutF}" 2>"${stderrF}"
- )
- grep "help string containing a ' char" "${stderrF}" >/dev/null
- grepped=$?
- assertTrue "help strings containing apostrophes don't work" ${grepped}
- [ ${grepped} -ne ${FLAGS_TRUE} ] && th_showOutput
-}
-
-mock_flags_columns()
-{
- echo 80
-}
-
-testStandardHelpOutput()
-{
- flags_getoptIsStd || startSkipping
-
- DEFINE_boolean test_bool false 'test boolean' b
- DEFINE_integer test_int 0 'test integer' i
- DEFINE_string test_str '' 'test string' s
- DEFINE_string long_desc 'blah' \
- 'testing of a long description to force wrap of default value' D
- DEFINE_string long_default \
- 'this_is_a_long_default_value_to_force_alternate_indentation' \
- 'testing of long default value' F
- help='USAGE: standard [flags] args'
-
- cat >"${expectedF}" <<EOF
-${help}
-flags:
- -b test boolean (default: false)
- -i test integer (default: 0)
- -s test string (default: '')
- -D testing of a long description to force wrap of default value
- (default: 'blah')
- -F testing of long default value
- (default: 'this_is_a_long_default_value_to_force_alternate_indentation')
- -h show this help (default: false)
-EOF
- (
- _flags_columns() { mock_flags_columns; }
- FLAGS_HELP=${help};
- FLAGS -h >"${stdoutF}" 2>"${stderrF}"
- )
- r3turn=$?
- assertTrue 'a call for help should not return an error' ${r3turn}
-
- diff "${expectedF}" "${stderrF}" >/dev/null
- r3turn=$?
- assertTrue 'unexpected help output' ${r3turn}
- th_showOutput ${r3turn} "${stdoutF}" "${stderrF}"
-}
-
-testEnhancedHelpOutput()
-{
- flags_getoptIsEnh || startSkipping
-
- DEFINE_boolean test_bool false 'test boolean' b
- DEFINE_integer test_int 0 'test integer' i
- DEFINE_string test_str '' 'test string' s
- DEFINE_string long_desc 'blah' \
- 'testing of a long description to force wrap of default value' D
- DEFINE_string long_default \
- 'this_is_a_long_default_value_to_force_alternate_indentation' \
- 'testing of long default value' F
- help='USAGE: enhanced [flags] args'
-
- cat >"${expectedF}" <<EOF
-${help}
-flags:
- -b,--[no]test_bool: test boolean (default: false)
- -i,--test_int: test integer (default: 0)
- -s,--test_str: test string (default: '')
- -D,--long_desc: testing of a long description to force wrap of default value
- (default: 'blah')
- -F,--long_default: testing of long default value
- (default: 'this_is_a_long_default_value_to_force_alternate_indentation')
- -h,--help: show this help (default: false)
-EOF
- (
- _flags_columns() { mock_flags_columns; }
- FLAGS_HELP=${help};
- FLAGS -h >"${stdoutF}" 2>"${stderrF}"
- )
- r3turn=$?
- assertTrue 'a call for help should not return an error' ${r3turn}
-
- diff "${expectedF}" "${stderrF}" >/dev/null
- differed=$?
- assertTrue 'unexpected help output' ${differed}
- th_showOutput ${differed} "${stdoutF}" "${stderrF}"
-}
-
-testNoHelp()
-{
- flags_getoptIsEnh || startSkipping
-
- ( FLAGS --nohelp >"${stdoutF}" 2>"${stderrF}" )
- r3turn=$?
- assertTrue "FLAGS returned a non-zero result (${r3turn})" ${r3turn}
- assertFalse 'expected no output to STDOUT' "[ -s '${stdoutF}' ]"
- assertFalse 'expected no output to STDERR' "[ -s '${stderrF}' ]"
-}
-
-#------------------------------------------------------------------------------
-# suite functions
-#
-
-oneTimeSetUp()
-{
- th_oneTimeSetUp
-
- if flags_getoptIsStd; then
- th_warn 'Standard version of getopt found. Enhanced tests will be skipped.'
- else
- th_warn 'Enhanced version of getopt found. Standard tests will be skipped.'
- fi
-}
-
-setUp()
-{
- flags_reset
-}
-
-# load and run shUnit2
-[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0
-. ${TH_SHUNIT}
diff --git a/test_results/1.0.1/Linux-Ubuntu_Dapper-6.06.txt b/test_results/1.0.1/Linux-Ubuntu_Dapper-6.06.txt
deleted file mode 100644
index 3aabbf2..0000000
--- a/test_results/1.0.1/Linux-Ubuntu_Dapper-6.06.txt
+++ /dev/null
@@ -1,430 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Fri Jul 11 16:40:56 IST 2008
-$ uname -mprsv
-Linux 2.6.18.5-gg34workstation-mixed64-32 #1 SMP Thu May 8 01:31:23 UTC 2008 x86_64 unknown
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-
-GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
-Copyright (C) 2005 Free Software Foundation, Inc.
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-test:WARN unable to run tests with the /bin/dash shell
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-
-version: 4.2.5
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
diff --git a/test_results/1.0.1/Linux-Ubuntu_Hardy-8.04.txt b/test_results/1.0.1/Linux-Ubuntu_Hardy-8.04.txt
deleted file mode 100644
index 537c17d..0000000
--- a/test_results/1.0.1/Linux-Ubuntu_Hardy-8.04.txt
+++ /dev/null
@@ -1,512 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Fri Jul 11 20:41:28 GMT 2008
-$ uname -mprsv
-Linux 2.6.24-19-server #1 SMP Wed Jun 18 15:18:00 UTC 2008 i686 unknown
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-
-GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu)
-Copyright (C) 2007 Free Software Foundation, Inc.
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-
- version sh (AT&T Research) 1993-12-28 s+
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-
-version: 4.3.4
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 179 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 8 89%
-tests failed: 0 0%
-tests skipped: 1 11%
-tests total: 9 100%
diff --git a/test_results/1.0.1/Mac_OS_X-10.5.4.txt b/test_results/1.0.1/Mac_OS_X-10.5.4.txt
deleted file mode 100644
index c4a3262..0000000
--- a/test_results/1.0.1/Mac_OS_X-10.5.4.txt
+++ /dev/null
@@ -1,368 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Fri Jul 11 21:38:16 IST 2008
-$ uname -mprsv
-Darwin 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386 i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-
-GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0)
-Copyright (C) 2005 Free Software Foundation, Inc.
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-test:WARN unable to run tests with the /bin/dash shell
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-
- version sh (AT&T Research) 1993-12-28 s+
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-test:WARN unable to run tests with the /bin/pdksh shell
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-
-version: 4.3.4
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
diff --git a/test_results/1.0.1/Solaris-9-U6-x86.txt b/test_results/1.0.1/Solaris-9-U6-x86.txt
deleted file mode 100644
index 1f223cc..0000000
--- a/test_results/1.0.1/Solaris-9-U6-x86.txt
+++ /dev/null
@@ -1,366 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Fri Jul 11 20:26:24 GMT 2008
-$ uname -mprsv
-SunOS 5.9 Generic_117172-08 i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-
-GNU bash, version 2.05.0(1)-release (i386-pc-solaris2.9)
-Copyright 2000 Free Software Foundation, Inc.
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-test:WARN unable to run tests with the /bin/dash shell
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-test:WARN unable to run tests with the /bin/pdksh shell
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-
-version: 3.0.8
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
diff --git a/test_results/1.0.1/Solaris-nv-77-x86.txt b/test_results/1.0.1/Solaris-nv-77-x86.txt
deleted file mode 100644
index 1ba12ae..0000000
--- a/test_results/1.0.1/Solaris-nv-77-x86.txt
+++ /dev/null
@@ -1,366 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Fri Jul 11 20:32:34 GMT 2008
-$ uname -mprsv
-SunOS 5.11 snv_77 i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-
-GNU bash, version 3.2.25(1)-release (i386-pc-solaris2.11)
-Copyright (C) 2005 Free Software Foundation, Inc.
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-test:WARN unable to run tests with the /bin/dash shell
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
-
-test:WARN unable to run tests with the /bin/pdksh shell
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-
-version: 4.3.4
-
---- Executing the 'defines' test suite ---
-#
-# Performing tests
-#
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-#
-# Test report
-#
-tests passed: 65 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 65 100%
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-#
-# Performing tests
-#
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result
-ASSERT:string (string with spaces) test failed.string (string with spaces) test failed. expected:<string with spaces> but was:<>
-flags:ERROR the available getopt does not support spaces in options
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-#
-# Test report
-#
-tests passed: 89 50%
-tests failed: 2 1%
-tests skipped: 88 49%
-tests total: 179 100%
-
---- Executing the 'private' test suite ---
-#
-# Performing tests
-#
-testGetFlagInfo
-testItemInList
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-#
-# Test report
-#
-tests passed: 50 100%
-tests failed: 0 0%
-tests skipped: 0 0%
-tests total: 50 100%
-
---- Executing the 'public' test suite ---
-#
-# Performing tests
-#
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-
-#
-# Test report
-#
-tests passed: 5 56%
-tests failed: 0 0%
-tests skipped: 4 44%
-tests total: 9 100%
diff --git a/test_results/1.0.2/Linux-Red_Hat_Linux_release_9_(Shrike).txt b/test_results/1.0.2/Linux-Red_Hat_Linux_release_9_(Shrike).txt
deleted file mode 100644
index 2a37140..0000000
--- a/test_results/1.0.2/Linux-Red_Hat_Linux_release_9_(Shrike).txt
+++ /dev/null
@@ -1,214 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sat Nov 15 12:24:30 PST 2008
-$ uname -mprsv
-Linux 2.4.22-gg17smp #17 SMP Thu Oct 4 14:35:48 IST 2007 i686 i686
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 2.05b.0(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.1.1
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
diff --git a/test_results/1.0.2/Linux-Ubuntu-6.06.txt b/test_results/1.0.2/Linux-Ubuntu-6.06.txt
deleted file mode 100644
index 6888a72..0000000
--- a/test_results/1.0.2/Linux-Ubuntu-6.06.txt
+++ /dev/null
@@ -1,328 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sat Nov 15 20:07:22 GMT 2008
-$ uname -mprsv
-Linux 2.6.18.5-gg38server-xenU-3.1 #1 SMP Fri Jul 18 13:02:34 IST 2008 x86_64 unknown
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.1.17(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-1993-12-28-r--$
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-shell name: pdksh
-shell version: v5.2.14-99/07/13.2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.2.5
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
diff --git a/test_results/1.0.2/Linux-Ubuntu-8.04.txt b/test_results/1.0.2/Linux-Ubuntu-8.04.txt
deleted file mode 100644
index 4b17c8d..0000000
--- a/test_results/1.0.2/Linux-Ubuntu-8.04.txt
+++ /dev/null
@@ -1,379 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sat Nov 15 17:17:19 GMT 2008
-$ uname -mprsv
-Linux 2.6.24-21-server #1 SMP Wed Oct 22 00:18:13 UTC 2008 i686 unknown
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.39(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-shell name: dash
-shell version: 0.5.4-8ubuntu1
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-1993-12-28
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-shell name: pdksh
-shell version: v5.2.14-99/07/13.2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.4
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
diff --git a/test_results/1.0.2/Mac_OS_X-10.5.5.txt b/test_results/1.0.2/Mac_OS_X-10.5.5.txt
deleted file mode 100644
index e60f1cc..0000000
--- a/test_results/1.0.2/Mac_OS_X-10.5.5.txt
+++ /dev/null
@@ -1,291 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sat Nov 15 20:17:09 GMT 2008
-$ uname -mprsv
-Darwin 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386 i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result (2)
-ASSERT:string (string with spaces) test failed. expected:<string with spaces> but was:<single_word>
->>> STDERR
-flags:FATAL the available getopt does not support spaces in options
->>> end output
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-FAILED (failures=2,skipped=92)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.17(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result (2)
-ASSERT:string (string with spaces) test failed. expected:<string with spaces> but was:<single_word>
->>> STDERR
-flags:FATAL the available getopt does not support spaces in options
->>> end output
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-FAILED (failures=2,skipped=92)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-1993-12-28
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result (2)
-ASSERT:string (string with spaces) test failed. expected:<string with spaces> but was:<single_word>
->>> STDERR
-flags:FATAL the available getopt does not support spaces in options
->>> end output
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-FAILED (failures=2,skipped=92)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.4
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result (2)
-ASSERT:string (string with spaces) test failed. expected:<string with spaces> but was:<single_word>
->>> STDERR
-flags:FATAL the available getopt does not support spaces in options
->>> end output
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-FAILED (failures=2,skipped=92)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
diff --git a/test_results/1.0.2/Solaris-11.txt b/test_results/1.0.2/Solaris-11.txt
deleted file mode 100644
index 929021f..0000000
--- a/test_results/1.0.2/Solaris-11.txt
+++ /dev/null
@@ -1,283 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sat Nov 15 00:06:53 GMT 2008
-$ uname -mprsv
-SunOS 5.11 snv_77 i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result (2)
-ASSERT:string (string with spaces) test failed. expected:<string with spaces> but was:<single_word>
->>> STDERR
-flags:FATAL the available getopt does not support spaces in options
->>> end output
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-FAILED (failures=2,skipped=92)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.25(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result (2)
-ASSERT:string (string with spaces) test failed. expected:<string with spaces> but was:<single_word>
->>> STDERR
-flags:FATAL the available getopt does not support spaces in options
->>> end output
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-FAILED (failures=2,skipped=92)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-11/16/88i
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result (2)
-ASSERT:string (string with spaces) test failed. expected:<string with spaces> but was:<single_word>
->>> STDERR
-flags:FATAL the available getopt does not support spaces in options
->>> end output
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-FAILED (failures=2,skipped=92)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.4
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Some tests will be skipped.
-testStandardGetopt
-testEnhancedGetopt
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-ASSERT:FLAGS (string with spaces) returned a non-zero result (2)
-ASSERT:string (string with spaces) test failed. expected:<string with spaces> but was:<single_word>
->>> STDERR
-flags:FATAL the available getopt does not support spaces in options
->>> end output
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-
-Ran 13 tests.
-
-FAILED (failures=2,skipped=92)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testScreenColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
diff --git a/test_results/1.0.3/Linux-Ubuntu-6.06.txt b/test_results/1.0.3/Linux-Ubuntu-6.06.txt
deleted file mode 100644
index 0cf34d6..0000000
--- a/test_results/1.0.3/Linux-Ubuntu-6.06.txt
+++ /dev/null
@@ -1,348 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Fri Apr 24 01:17:02 IST 2009
-$ uname -mprsv
-Linux 2.6.18.5-gg38server-xenU-3.1 #1 SMP Fri Jul 18 13:02:34 IST 2008 x86_64 unknown
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.1.17(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-1993-12-28-r--$
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-shell name: pdksh
-shell version: v5.2.14-99/07/13.2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.2.5
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
diff --git a/test_results/1.0.3/Linux-Ubuntu-8.04.txt b/test_results/1.0.3/Linux-Ubuntu-8.04.txt
deleted file mode 100644
index b180dd0..0000000
--- a/test_results/1.0.3/Linux-Ubuntu-8.04.txt
+++ /dev/null
@@ -1,409 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sat Apr 18 06:27:02 GMT 2009
-$ uname -mprsv
-Linux 2.6.24-23-server #1 SMP Wed Apr 1 22:22:14 UTC 2009 i686 unknown
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.39(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-shell name: dash
-shell version: 0.5.4-8ubuntu1.1
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-1993-12-28
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-shell name: pdksh
-shell version: v5.2.14-99/07/13.2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.4
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
diff --git a/test_results/1.0.3/Mac_OS_X-10.5.6.txt b/test_results/1.0.3/Mac_OS_X-10.5.6.txt
deleted file mode 100644
index 148f6e7..0000000
--- a/test_results/1.0.3/Mac_OS_X-10.5.6.txt
+++ /dev/null
@@ -1,287 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Mon Apr 20 04:46:09 IST 2009
-$ uname -mprsv
-Darwin 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=104)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.17(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=104)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-1993-12-28
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=104)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.4
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=104)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
diff --git a/test_results/1.0.3/Solaris-5.11-NexentaOS_20081207.txt b/test_results/1.0.3/Solaris-5.11-NexentaOS_20081207.txt
deleted file mode 100644
index 19b78d1..0000000
--- a/test_results/1.0.3/Solaris-5.11-NexentaOS_20081207.txt
+++ /dev/null
@@ -1,235 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sat Apr 25 13:21:10 IST 2009
-$ uname -mprsv
-SunOS 5.11 NexentaOS_20081207 i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-ASSERT:failed str test expected:<two> but was:<>
-ASSERT:failed float test expected:<3> but was:<0.0>
-ASSERT:incorrect number of argv values expected:<3> but was:<6>
-
-Ran 16 tests.
-
-FAILED (failures=3,skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.33(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-ASSERT:failed str test expected:<two> but was:<>
-ASSERT:failed float test expected:<3> but was:<0.0>
-ASSERT:incorrect number of argv values expected:<3> but was:<6>
-
-Ran 16 tests.
-
-FAILED (failures=3,skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-ASSERT:failed str test expected:<two> but was:<>
-ASSERT:failed float test expected:<3> but was:<0.0>
-ASSERT:incorrect number of argv values expected:<3> but was:<6>
-
-Ran 16 tests.
-
-FAILED (failures=3,skipped=3)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=1)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
diff --git a/test_results/1.0.3/Solaris-5.11-snv_77.txt b/test_results/1.0.3/Solaris-5.11-snv_77.txt
deleted file mode 100644
index 79969fc..0000000
--- a/test_results/1.0.3/Solaris-5.11-snv_77.txt
+++ /dev/null
@@ -1,287 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sat Apr 25 12:20:26 GMT 2009
-$ uname -mprsv
-SunOS 5.11 snv_77 i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=104)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.25(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=104)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-11/16/88i M-11/16/88i
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=104)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.4
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBooleanShort
-testValidBooleanLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK (skipped=104)
-
---- Executing the 'private' test suite ---
-testGetFlagInfo
-testItemInList
-testColumns
-testValidateBoolean
-testValidateFloat
-testValidateInteger
-
-Ran 6 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=6)
diff --git a/test_results/1.2.0/FreeBSD-9.1.txt b/test_results/1.2.0/FreeBSD-9.1.txt
deleted file mode 100644
index 9980680..0000000
--- a/test_results/1.2.0/FreeBSD-9.1.txt
+++ /dev/null
@@ -1,111 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Tue Jan 15 00:08:36 UTC 2013
-$ uname -mprsv
-FreeBSD 9.1-RELEASE FreeBSD 9.1-RELEASE #0: Fri Dec 7 20:50:48 GMT 2012 kirk@freenas:/usr/obj/usr/src/sys/GENERIC amd64 amd64
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
diff --git a/test_results/1.2.0/Linux-Ubuntu-10.04.4-LTS.txt b/test_results/1.2.0/Linux-Ubuntu-10.04.4-LTS.txt
deleted file mode 100644
index 4dc2fb5..0000000
--- a/test_results/1.2.0/Linux-Ubuntu-10.04.4-LTS.txt
+++ /dev/null
@@ -1,451 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Tue Jan 15 00:09:41 UTC 2013
-$ uname -mprsv
-Linux 2.6.32-45-server #101-Ubuntu SMP Mon Dec 3 15:54:27 UTC 2012 x86_64 unknown
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 4.1.5(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-shell name: dash
-shell version: 0.5.5.1-3ubuntu2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: JM-93t+-2009-05-01-$
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-shell name: pdksh
-shell version: v5.2.14-99/07/13.2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.10
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
diff --git a/test_results/1.2.0/Linux-Ubuntu-12.04.1-LTS.txt b/test_results/1.2.0/Linux-Ubuntu-12.04.1-LTS.txt
deleted file mode 100644
index c3a2a0d..0000000
--- a/test_results/1.2.0/Linux-Ubuntu-12.04.1-LTS.txt
+++ /dev/null
@@ -1,451 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Tue Jan 15 00:09:47 GMT 2013
-$ uname -mprsv
-Linux 3.2.0-35-generic #55-Ubuntu SMP Wed Dec 5 17:42:16 UTC 2012 x86_64 x86_64
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 4.2.24(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-shell name: dash
-shell version: 0.5.7-2ubuntu2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: JM-93u-2011-02-08-$
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-shell name: pdksh
-shell version: v5.2.14-99/07/13.2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.17
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
diff --git a/test_results/1.2.0/Linux-Ubuntu-14.04.3-LTS.txt b/test_results/1.2.0/Linux-Ubuntu-14.04.3-LTS.txt
deleted file mode 100644
index eb05518..0000000
--- a/test_results/1.2.0/Linux-Ubuntu-14.04.3-LTS.txt
+++ /dev/null
@@ -1,451 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sun Jan 10 19:09:28 CET 2016
-$ uname -mprsv
-Linux 4.2.0-22-generic #27~14.04.1-Ubuntu SMP Fri Dec 18 10:57:53 UTC 2015 x86_64 x86_64
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 4.3.11(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-shell name: dash
-shell version: 0.5.7-4ubuntu1
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: AJM-93u+-2012-08-01-$
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-shell name: pdksh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 5.0.2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
diff --git a/test_results/1.2.0/Linux-Ubuntu-8.04.4-LTS.txt b/test_results/1.2.0/Linux-Ubuntu-8.04.4-LTS.txt
deleted file mode 100644
index 62d42f8..0000000
--- a/test_results/1.2.0/Linux-Ubuntu-8.04.4-LTS.txt
+++ /dev/null
@@ -1,451 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Mon Jan 14 18:09:57 CST 2013
-$ uname -mprsv
-Linux 2.6.24-32-server #1 SMP Mon Dec 3 15:54:12 UTC 2012 x86_64 unknown
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.39(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-shell name: dash
-shell version: 0.5.4-8ubuntu1.1
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-1993-12-28
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-shell name: pdksh
-shell version: v5.2.14-99/07/13.2
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.4
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Enhanced version of getopt found. Standard tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=2)
diff --git a/test_results/1.2.0/Mac_OS_X-10.10.3.txt b/test_results/1.2.0/Mac_OS_X-10.10.3.txt
deleted file mode 100644
index e81ae0f..0000000
--- a/test_results/1.2.0/Mac_OS_X-10.10.3.txt
+++ /dev/null
@@ -1,315 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Sun Jan 10 19:09:43 CET 2016
-$ uname -mprsv
-Darwin 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:20:09 PST 2015; root:xnu-3248.30.4~2/RELEASE_X86_64 x86_64 i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.57(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: AJM-93u+-2012-08-01-$
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 5.0.8
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
diff --git a/test_results/1.2.0/Mac_OS_X-10.8.2.txt b/test_results/1.2.0/Mac_OS_X-10.8.2.txt
deleted file mode 100644
index c03b407..0000000
--- a/test_results/1.2.0/Mac_OS_X-10.8.2.txt
+++ /dev/null
@@ -1,315 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Tue Jan 15 01:10:24 CET 2013
-$ uname -mprsv
-Darwin 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.48(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: JM-93u-2011-02-08-$
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.3.11
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
diff --git a/test_results/1.2.0/OpenSolaris-2009.06(snv_111b).txt b/test_results/1.2.0/OpenSolaris-2009.06(snv_111b).txt
deleted file mode 100644
index 250dd52..0000000
--- a/test_results/1.2.0/OpenSolaris-2009.06(snv_111b).txt
+++ /dev/null
@@ -1,247 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Tue Jan 15 00:08:39 GMT 2013
-$ uname -mprsv
-SunOS 5.11 snv_111b i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.25(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
diff --git a/test_results/1.2.0/Solaris-10u10.txt b/test_results/1.2.0/Solaris-10u10.txt
deleted file mode 100644
index ee3083b..0000000
--- a/test_results/1.2.0/Solaris-10u10.txt
+++ /dev/null
@@ -1,316 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Tue Jan 15 01:09:38 MET 2013
-$ uname -mprsv
-SunOS 5.10 Generic_147441-01 i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-test:WARN Shell built-ins not supported. Some tests will be skipped.
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK (skipped=46)
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 3.2.51(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-11/16/88i
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 4.2.1
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
diff --git a/test_results/1.2.0/Solaris-8u7.txt b/test_results/1.2.0/Solaris-8u7.txt
deleted file mode 100644
index 754672c..0000000
--- a/test_results/1.2.0/Solaris-8u7.txt
+++ /dev/null
@@ -1,316 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Tue Jan 15 00:08:59 GMT 2013
-$ uname -mprsv
-SunOS 5.8 Generic_108529-13 i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-test:WARN Shell built-ins not supported. Some tests will be skipped.
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK (skipped=46)
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 2.03.0(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-11/16/88i
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 3.0.6
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
diff --git a/test_results/1.2.0/Solaris-9u8.txt b/test_results/1.2.0/Solaris-9u8.txt
deleted file mode 100644
index 2ae38f4..0000000
--- a/test_results/1.2.0/Solaris-9u8.txt
+++ /dev/null
@@ -1,316 +0,0 @@
-#------------------------------------------------------------------------------
-# System data
-#
-
-# test run info
-shells="/bin/sh /bin/bash /bin/dash /bin/ksh /bin/pdksh /bin/zsh"
-tests=" shflags_test_defines.sh shflags_test_parsing.sh shflags_test_private.sh shflags_test_public.sh"
-
-# system info
-$ date
-Tue Jan 15 00:09:36 GMT 2013
-$ uname -mprsv
-SunOS 5.9 Generic_118559-11 i86pc i386
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/sh
-#
-shell name: sh
-shell version: unknown
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-test:WARN Shell built-ins not supported. Some tests will be skipped.
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK (skipped=46)
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/bash
-#
-shell name: bash
-shell version: 2.05.0(1)-release
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/dash
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/ksh
-#
-shell name: ksh
-shell version: M-11/16/88i
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/pdksh
-#
-
-
-#------------------------------------------------------------------------------
-# Running the test suite with /bin/zsh
-#
-shell name: zsh
-shell version: 3.0.8
-
---- Executing the 'defines' test suite ---
-testFlagsDefine
-testBoolean
-testFloat
-testInteger
-testString
-testShortNameLength
-testFlagNameIsReserved
-
-Ran 7 tests.
-
-OK
-
---- Executing the 'parsing' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testGetoptStandard
-testGetoptEnhanced
-testValidBoolsShort
-testValidBoolsLong
-testValidFloats
-testInvalidFloats
-testValidIntegers
-testInvalidIntegers
-testValidStrings
-testMultipleFlags
-testSingleNonFlagArg
-testMultipleNonFlagArgs
-testMultipleNonFlagStringArgsWithSpaces
-testFlagsWithEquals
-testComplicatedCommandLineStandard
-testComplicatedCommandLineEnhanced
-
-Ran 16 tests.
-
-OK
-
---- Executing the 'private' test suite ---
-testColumns
-testGenOptStr
-testGetFlagInfo
-testItemInList
-testValidBool
-testValidFloatBuiltin
-testValidFloatExpr
-testValidIntBuiltin
-testValidIntExpr
-testMathBuiltin
-testMathExpr
-testStrlenBuiltin
-testStrlenExpr
-
-Ran 13 tests.
-
-OK
-
---- Executing the 'public' test suite ---
-test:WARN Standard version of getopt found. Enhanced tests will be skipped.
-testHelp
-testStandardHelpOutput
-testEnhancedHelpOutput
-testNoHelp
-
-Ran 4 tests.
-
-OK (skipped=5)
diff --git a/test_runner b/test_runner
new file mode 100755
index 0000000..22aed9e
--- /dev/null
+++ b/test_runner
@@ -0,0 +1,191 @@
+#! /bin/sh
+# vim:et:ft=sh:sts=2:sw=2
+#
+# Unit test suite runner.
+#
+# Copyright 2008-2020 Kate Ward. All Rights Reserved.
+# Released under the Apache 2.0 license.
+#
+# Author: kate.ward@forestent.com (Kate Ward)
+# https://github.com/kward/shlib
+#
+# This script runs all the unit tests that can be found, and generates a nice
+# report of the tests.
+#
+### Sample usage:
+#
+# Run all tests for all shells.
+# $ ./test_runner
+#
+# Run all tests for single shell.
+# $ ./test_runner -s /bin/bash
+#
+# Run single test for all shells.
+# $ ./test_runner -t shunit_asserts_test.sh
+#
+# Run single test for single shell.
+# $ ./test_runner -s /bin/bash -t shunit_asserts_test.sh
+#
+### ShellCheck (http://www.shellcheck.net/)
+# Disable source following.
+# shellcheck disable=SC1090,SC1091
+# expr may be antiquated, but it is the only solution in some cases.
+# shellcheck disable=SC2003
+# $() are not fully portable (POSIX != portable).
+# shellcheck disable=SC2006
+
+# Return if test_runner already loaded.
+[ -z "${RUNNER_LOADED:-}" ] || return 0
+RUNNER_LOADED=0
+
+RUNNER_ARGV0=`basename "$0"`
+RUNNER_SHELLS='/bin/sh ash /bin/bash /bin/dash /bin/ksh /bin/mksh /bin/zsh'
+RUNNER_TEST_SUFFIX='_test.sh'
+true; RUNNER_TRUE=$?
+false; RUNNER_FALSE=$?
+
+runner_warn() { echo "runner:WARN $*" >&2; }
+runner_error() { echo "runner:ERROR $*" >&2; }
+runner_fatal() { echo "runner:FATAL $*" >&2; exit 1; }
+
+runner_usage() {
+ echo "usage: ${RUNNER_ARGV0} [-e key=val ...] [-s shell(s)] [-t test(s)]"
+}
+
+_runner_tests() { echo ./*${RUNNER_TEST_SUFFIX} |sed 's#\./##g'; }
+_runner_testName() {
+ # shellcheck disable=SC1117
+ _runner_testName_=`expr "${1:-}" : "\(.*\)${RUNNER_TEST_SUFFIX}"`
+ if [ -n "${_runner_testName_}" ]; then
+ echo "${_runner_testName_}"
+ else
+ echo 'unknown'
+ fi
+ unset _runner_testName_
+}
+
+main() {
+ # Find and load versions library.
+ for _runner_dir_ in . ${LIB_DIR:-lib}; do
+ if [ -r "${_runner_dir_}/versions" ]; then
+ _runner_lib_dir_="${_runner_dir_}"
+ break
+ fi
+ done
+ [ -n "${_runner_lib_dir_}" ] || runner_fatal 'Unable to find versions library.'
+ . "${_runner_lib_dir_}/versions" || runner_fatal 'Unable to load versions library.'
+ unset _runner_dir_ _runner_lib_dir_
+
+ # Process command line flags.
+ env=''
+ while getopts 'e:hs:t:' opt; do
+ case ${opt} in
+ e) # set an environment variable
+ key=`expr "${OPTARG}" : '\([^=]*\)='`
+ val=`expr "${OPTARG}" : '[^=]*=\(.*\)'`
+ # shellcheck disable=SC2166
+ if [ -z "${key}" -o -z "${val}" ]; then
+ runner_usage
+ exit 1
+ fi
+ eval "${key}='${val}'"
+ eval "export ${key}"
+ env="${env:+${env} }${key}"
+ ;;
+ h) runner_usage; exit 0 ;; # help output
+ s) shells=${OPTARG} ;; # list of shells to run
+ t) tests=${OPTARG} ;; # list of tests to run
+ *) runner_usage; exit 1 ;;
+ esac
+ done
+ shift "`expr ${OPTIND} - 1`"
+
+ # Fill shells and/or tests.
+ shells=${shells:-${RUNNER_SHELLS}}
+ [ -z "${tests}" ] && tests=`_runner_tests`
+
+ # Error checking.
+ if [ -z "${tests}" ]; then
+ runner_error 'no tests found to run; exiting'
+ exit 1
+ fi
+
+ cat <<EOF
+#------------------------------------------------------------------------------
+# System data.
+#
+
+$ uname -mprsv
+`uname -mprsv`
+
+OS Name: `versions_osName`
+OS Version: `versions_osVersion`
+
+### Test run info.
+shells: ${shells}
+tests: ${tests}
+EOF
+for key in ${env}; do
+ eval "echo \"${key}=\$${key}\""
+done
+
+# Run tests.
+runner_passing_=${RUNNER_TRUE}
+for shell in ${shells}; do
+ echo
+
+ cat <<EOF
+
+#------------------------------------------------------------------------------
+# Running the test suite with ${shell}.
+#
+EOF
+
+ # Check for existence of shell.
+ shell_bin=${shell}
+ shell_name=''
+ shell_present=${RUNNER_FALSE}
+ case ${shell} in
+ ash)
+ shell_bin=`command -v busybox`
+ [ $? -eq "${RUNNER_TRUE}" ] && shell_present="${RUNNER_TRUE}"
+ shell_bin="${shell_bin:+${shell_bin} }ash"
+ shell_name=${shell}
+ ;;
+ *)
+ [ -x "${shell_bin}" ] && shell_present="${RUNNER_TRUE}"
+ shell_name=`basename "${shell}"`
+ ;;
+ esac
+ if [ "${shell_present}" -eq "${RUNNER_FALSE}" ]; then
+ runner_warn "unable to run tests with the ${shell_name} shell"
+ continue
+ fi
+
+ shell_version=`versions_shellVersion "${shell}"`
+
+ echo "shell name: ${shell_name}"
+ echo "shell version: ${shell_version}"
+
+ # Execute the tests.
+ for t in ${tests}; do
+ echo
+ echo "--- Executing the '`_runner_testName "${t}"`' test suite. ---"
+ # ${shell_bin} needs word splitting.
+ # shellcheck disable=SC2086
+ ( exec ${shell_bin} "./${t}" 2>&1; )
+ shell_passing=$?
+ if [ "${shell_passing}" -ne "${RUNNER_TRUE}" ]; then
+ runner_warn "${shell_bin} not passing"
+ fi
+ test "${runner_passing_}" -eq ${RUNNER_TRUE} -a ${shell_passing} -eq ${RUNNER_TRUE}
+ runner_passing_=$?
+ done
+ done
+ return ${runner_passing_}
+}
+
+# Execute main() if this is run in standalone mode (i.e. not from a unit test).
+if [ -z "${SHUNIT_VERSION}" ]; then
+ main "$@"
+fi