mirror of
https://github.com/envmodules/modules.git
synced 2026-06-18 00:06:53 +08:00
testsuite: test modpath var ref in 10-use/030-use
This commit is contained in:
@@ -968,7 +968,7 @@ proc resolvStringWithEnv {0str} {
|
||||
if {[info exists ::env(${0varname})]} {
|
||||
set ${0varname} $::env(${0varname})
|
||||
} else {
|
||||
set ${0varname} ""
|
||||
set ${0varname} ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,30 @@ set ::env(MODULEPATH) "$mod_path"
|
||||
# list currently enabled paths
|
||||
testouterr_cmd "ALL" "$use" "OK" "$path_list_header\n $path\n $ORIG"
|
||||
|
||||
#
|
||||
# Test variable resolution
|
||||
#
|
||||
|
||||
# setup value with multiple occurencies of same variable
|
||||
set var_path "/apps/\$OS/\$MACHINE/\$OS"
|
||||
set os $tcl_platform(os)
|
||||
set machine $tcl_platform(machine)
|
||||
if { $verbose > 0 } {
|
||||
send_user "\tSetup MODULEPATH = '$var_path'\n"
|
||||
}
|
||||
set ::env(MODULEPATH) "$var_path"
|
||||
|
||||
# tests when variable are defined or not
|
||||
# Currenlty if variable is not defined, directory level is omitted. Should
|
||||
# preferably skip path element if one variable referred is undefined (to be
|
||||
# fixed in next major release v5.0)
|
||||
testouterr_cmd "sh" "$use" "OK" "$path_list_header\n /apps"
|
||||
set ::env(OS) $os
|
||||
testouterr_cmd "sh" "$use" "OK" "$path_list_header\n /apps/$os/$os"
|
||||
set ::env(MACHINE) $machine
|
||||
testouterr_cmd "sh" "$use" "OK" "$path_list_header\n /apps/$os/$machine/$os"
|
||||
|
||||
|
||||
if { $verbose > 0 } {
|
||||
send_user "\tRestore MODULEPATH = $ORIG\n"
|
||||
}
|
||||
@@ -133,6 +157,11 @@ testouterr_cmd "ALL" "$use " "ERR" "$empty_use"
|
||||
# Cleanup
|
||||
#
|
||||
|
||||
unset os
|
||||
unset machine
|
||||
unset env(OS)
|
||||
unset env(MACHINE)
|
||||
|
||||
unset path
|
||||
unset tsdirname
|
||||
unset relpath
|
||||
|
||||
Reference in New Issue
Block a user