Skip to content

Commit

Permalink
ts: test alias/indesym output on list subcmd
Browse files Browse the repository at this point in the history
  • Loading branch information
xdelaruelle committed Jul 2, 2023
1 parent 77ad34a commit d91459c
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
27 changes: 27 additions & 0 deletions testsuite/modules.00-init/140-color.exp
Expand Up @@ -541,6 +541,33 @@ unsetenv_var MODULES_ADVANCED_VERSION_SPEC
setenv_path_var MODULEPATH $modpath


#
# alias/indesym rendering tests on list
#

setenv_var MODULES_COLORS {hi=1:db=2:tr=2:se=2:er=91:wa=93:me=95:in=94:mp=1;94:di=94:al=96:de=4:sy=95}
setenv_loaded_module [list foo/1.0] [list $modpath.3/foo/1.0]
setenv_var __MODULES_LMALTNAME foo/1.0&foo/bar&foo&al|alfoo

#FIXME
set tserr " 1\\) [sgr 96]alfoo[sgr 0] 2\\) foo/1.0[sgr 2]\\([sgr 22][sgr 95]bar[sgr 0][sgr 2]\\)[sgr 22]

Key:
[sgr 2]\\([sgr 22][sgr 95]symbolic-version[sgr 0][sgr 2]\\)[sgr 22] [sgr 96]module-alias[sgr 0] "
testouterr_cmd_re sh {list --color=always -o alias:idx:sym:key} OK $tserr
set tserr " 1\\) [sgr 95]foo/bar[sgr 0]
2\\) [sgr 96]alfoo[sgr 0]
3\\) foo/1.0

Key:
[sgr 95]symbolic-version[sgr 0] [sgr 96]module-alias[sgr 0] "
testouterr_cmd_re sh {list --color=always -t -o alias:idx:indesym:sym:key} OK $tserr

unsetenv_var __MODULES_LMALTNAME
unsetenv_loaded_module
unsetenv_var MODULES_COLORS


#
# Clean up variables used in this test case
#
Expand Down
23 changes: 23 additions & 0 deletions testsuite/modules.70-maint/361-list_output.exp
Expand Up @@ -242,6 +242,29 @@ unsetenv_var MODULES_LIST_TERSE_OUTPUT
unsetenv_var __MODULES_LMTAG


#
# alias test
#

setenv_var __MODULES_LMALTNAME foo/1.0&foo/bar&foo&al|alfoo
testouterr_cmd sh {list --output=alias:idx} OK " 1) alfoo 2) foo/1.0 "
testouterr_cmd sh {list --output=alias:idx:sym:key} OK " 1) alfoo(@) 2) foo/1.0(bar) \n\nKey:\n(@)=module-alias (symbolic-version) "
setenv_var MODULES_LIST_TERSE_OUTPUT idx:alias
testouterr_cmd sh {list -t} OK " 1) alfoo \n 2) foo/1.0 "
unsetenv_var MODULES_LIST_TERSE_OUTPUT


#
# indesym test
#

testouterr_cmd sh {list --output=indesym:idx} OK " 1) foo/bar 2) foo/1.0 "
testouterr_cmd sh {list --output=alias:idx:indesym:sym:key} OK " 1) foo/bar 2) alfoo 3) foo/1.0 "
setenv_var MODULES_LIST_TERSE_OUTPUT idx:alias:sym:indesym
testouterr_cmd sh {list -t} OK " 1) foo/bar \n 2) alfoo \n 3) foo/1.0 "
unsetenv_var MODULES_LIST_TERSE_OUTPUT


#
# -o/--output append/subtract tests
#
Expand Down
24 changes: 24 additions & 0 deletions testsuite/modules.70-maint/400-list-search.exp
Expand Up @@ -208,6 +208,30 @@ unsetenv_loaded_module
unsetenv_var MODULES_ADVANCED_VERSION_SPEC


# alias & indesym
setenv_loaded_module [list foo/1.0] [list $mp/foo/1.0]
setenv_var __MODULES_LMALTNAME foo/1.0&foo/bar&foo&al|foo/qux
testouterr_cmd sh {list -t -o alias:indesym foo} OK "foo/bar\nfoo/qux\nfoo/1.0"
testouterr_cmd sh {list -t -o alias:indesym foo/1} OK foo/1.0
testouterr_cmd sh {list -t -o alias:indesym foo/b} OK foo/bar
testouterr_cmd sh {list -t -o alias:indesym foo/q} OK foo/qux

testouterr_cmd sh {list -t -o tag foo/b} OK foo/1.0
testouterr_cmd sh {list -t -o tag foo/q} OK foo/1.0

# hidden-loaded tag does not apply to symbol or alias
setenv_var __MODULES_LMTAG foo/1.0&hidden-loaded
testouterr_cmd sh {list -t -o alias:indesym foo/1} OK {}
testouterr_cmd sh {list -t -o alias:indesym foo/b} OK foo/bar
testouterr_cmd sh {list -t -o alias:indesym foo/q} OK foo/qux
testouterr_cmd sh {list -t -o alias:indesym foo} OK "foo/bar\nfoo/qux"


unsetenv_path_var __MODULES_LMTAG
unsetenv_path_var __MODULES_LMALTNAME
unsetenv_loaded_module


#
# Cleanup
#
Expand Down

0 comments on commit d91459c

Please sign in to comment.