mo/tests
Tyler Akins 7e86c1a5f5
Detect when variables are declared and not set
It is possible to declare a variable but not assign a value to it using
`export x`. When you do this, `declare -p x` shows the variable but does
not show an "=" nor any value afterwards.

When running another command, this variable will not be added to the
environment variables even though it is flagged as exported. Most likely
it's because the value is not a string and can't be easily converted to
a string; this is the same behavior as arrays.

Using `[[ -v x ]]` is also inadequate and I believe its because there
are false positives when trying to access data, which goes on to break
tests and the new braces and parenthesis indirection. Perhaps it could
be reviewed and made to work.

The best solution so far is to combine `declare -p` with `[[ -v` to see
if the variable is declared and if a value is set.

Closes #75.
2024-07-24 12:22:03 -05:00
..
fixtures Releasing 3.0.0 2023-05-07 21:18:00 -05:00
ampersand Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
array Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
assoc-array More Bash 4.x compatibility issues found and fixed 2023-05-12 08:17:57 -05:00
comment Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
comment-newline Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
comment-with-spaces Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
concatenated-variables Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
delimiters Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
double-hyphen Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
double-quote Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
fail-not-set Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
fail-on-function Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
false-is-empty-arg Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
false-is-empty-env Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
false-list Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
function All tests pass. 2023-04-23 09:24:36 -05:00
function-alternate-delimiters All tests pass. 2023-04-23 09:24:36 -05:00
function-args All tests pass. 2023-04-23 09:24:36 -05:00
function-args-read More Bash 4.x compatibility issues found and fixed 2023-05-12 08:17:57 -05:00
function-with-more-parsing All tests pass. 2023-04-23 09:24:36 -05:00
globals-in-loop Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
help Detect when variables are declared and not set 2024-07-24 12:22:03 -05:00
indented-partials Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
inline-indentation Releasing 3.0.0 2023-05-07 21:18:00 -05:00
internal-whitespace Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
invalid-option More bugfixes and shellcheck tweaks 2023-04-10 11:39:47 -05:00
inverted Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
issue-75 Detect when variables are declared and not set 2024-07-24 12:22:03 -05:00
list-contexts Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
miss Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
multi-line-partial Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
mush Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
no-content Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
partial Releasing 3.0.0 2023-05-07 21:18:00 -05:00
partial-bad-file Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
partial-missing Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
single-quote Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
single-variable-replacement Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
source Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
source-bad-file Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
source-multiple Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
source-no-file Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
standalone-indentation Moving delimiters and standalone to global vars 2023-04-10 13:24:06 -05:00
triple-brace Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
typical Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
unbound-variable Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
variable Pass shellcheck, more specs are handled, preserve function whitespace 2023-04-10 08:10:14 -05:00
variable-braces-and-parenthesis All tests pass. 2023-04-23 09:24:36 -05:00