Skip to content

Commit

Permalink
UNIX shell script testing - Fix missing presence of $TERM environment…
Browse files Browse the repository at this point in the history
… variable.

Set default TERM to xterm-basic
  • Loading branch information
noresources committed Oct 31, 2024
1 parent c2a8fac commit 9249c45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
11 changes: 4 additions & 7 deletions resources/xsh/run-tests.body.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ NORMAL_COLOR==''
ERROR_COLOR=''
SUCCESS_COLOR=''

if [ ! -z "${TERM}" ]
then
# http://stackoverflow.com/questions/4332478/read-the-current-text-color-in-a-xterm/4332530#4332530
NORMAL_COLOR="$(tput sgr0)"
ERROR_COLOR="$(tput setaf 1)"
SUCCESS_COLOR="$(tput setaf 2)"
fi
# http://stackoverflow.com/questions/4332478/read-the-current-text-color-in-a-xterm/4332530#4332530
NORMAL_COLOR="$(tput -Txterm-basic sgr0)"
ERROR_COLOR="$(tput -Txterm-basic setaf 1)"
SUCCESS_COLOR="$(tput -Txterm-basic setaf 2)"

log()
{
Expand Down
8 changes: 3 additions & 5 deletions tests/xsh/testprogram.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@
</xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$sh.endl" />
<xsl:text>[ -z "${TERM}" ] &amp;&amp; export TERM=xterm-basic</xsl:text>
<xsl:text>NORMAL_COLOR="$(tput -Txterm-basic sgr0)"</xsl:text>
<xsl:value-of select="$sh.endl" />
<xsl:text>NORMAL_COLOR="$(tput sgr0)"</xsl:text>
<xsl:text>ERROR_COLOR="$(tput -Txterm-basic setaf 1)"</xsl:text>
<xsl:value-of select="$sh.endl" />
<xsl:text>ERROR_COLOR="$(tput setaf 1)"</xsl:text>
<xsl:value-of select="$sh.endl" />
<xsl:text>SUCCESS_COLOR="$(tput setaf 2)"</xsl:text>
<xsl:text>SUCCESS_COLOR="$(tput -Txterm-basic setaf 2)"</xsl:text>
<xsl:value-of select="$sh.endl" />
<xsl:text>testResultFormat="%-40.40s | %-8s\n"</xsl:text>
<xsl:value-of select="$sh.endl" />
Expand Down

0 comments on commit 9249c45

Please sign in to comment.