############################################################################## # Modules Revision 3.0 # Providing a flexible user environment # # File: modules.00-init/%M% # Revision: %I% # First Edition: 2016/08/28 # Last Mod.: %U%, %G% # # Authors: Xavier Delaruelle, xavier.delaruelle@cea.fr # # Description: Testuite testsequence # Command: # Sub-Command: # # Comment: %C{ # Check module commands against wrong argument number. # }C% # ############################################################################## # # The following answers are to be expected in this testcase ... # set bad_arg1 "$error_msgs: Unexpected number of args for '" set bad_arg2 "' command" # # The tests # if {$verbose} { send_user "\tChecking commands against wrong argument number...\n" } # empty argument list on load command does not lead to error (nop) testouterr_cmd "sh" "load" "OK" "" # check first arg is split internally for argument list passed as a single string lappend ans [list set __MODULES_LMALTNAME "loc_dv2/1.0&loc_dv2/default&loc_dv2"] lappend ans [list set _LMFILES_ "$modpath/loc_dv2/1.0"] lappend ans [list set LOADEDMODULES "loc_dv2/1.0"] testouterr_cmd "sh" "NOCMDSPLITload loc_dv2/1.0" $ans "" # unexpected number of arguments leads to error code testouterr_cmd "ALL" "unload" "ERR" "${bad_arg1}unload${bad_arg2}\n$err_typehelp" # only check sh shell for the remaining test, as we already test above # that every supported shells respond correctly to error raise testall_cmd "sh" "reload foo" "ERR" "${bad_arg1}reload${bad_arg2}\n$err_typehelp" 1 testall_cmd "sh" "update foo" "ERR" "${bad_arg1}reload${bad_arg2}\n$err_typehelp" 1 testouterr_cmd "sh" "source" "ERR" "${bad_arg1}source${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "switch" "ERR" "${bad_arg1}switch${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "switch foo1 bar foo2" "ERR" "${bad_arg1}switch${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "show" "ERR" "${bad_arg1}display${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "display" "ERR" "${bad_arg1}display${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "aliases foo" "ERR" "${bad_arg1}aliases${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "path" "ERR" "${bad_arg1}path${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "path foo bar" "ERR" "${bad_arg1}path${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "paths" "ERR" "${bad_arg1}paths${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "paths foo bar" "ERR" "${bad_arg1}paths${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "search foo bar" "ERR" "${bad_arg1}search${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "purge foo" "ERR" "${bad_arg1}purge${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "save foo bar" "ERR" "${bad_arg1}save${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "restore foo bar" "ERR" "${bad_arg1}restore${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "saverm foo bar" "ERR" "${bad_arg1}saverm${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "disable foo bar" "ERR" "${bad_arg1}saverm${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "saveshow foo bar" "ERR" "${bad_arg1}saveshow${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "describe foo bar" "ERR" "${bad_arg1}saveshow${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "initadd" "ERR" "${bad_arg1}initadd${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "initprepend" "ERR" "${bad_arg1}initprepend${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "initswitch" "ERR" "${bad_arg1}initswitch${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "initswitch foo1 bar foo2" "ERR" "${bad_arg1}initswitch${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "initrm" "ERR" "${bad_arg1}initrm${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "initlist foo" "ERR" "${bad_arg1}initlist${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "initclear foo" "ERR" "${bad_arg1}initclear${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "autoinit foo" "ERR" "${bad_arg1}autoinit${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "test" "ERR" "${bad_arg1}test${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "append-path" "ERR" "${bad_arg1}append-path${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "prepend-path" "ERR" "${bad_arg1}prepend-path${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "remove-path" "ERR" "${bad_arg1}remove-path${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "is-avail" "ERR" "${bad_arg1}is-avail${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "info-loaded" "ERR" "${bad_arg1}info-loaded${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "config foo bar foo" "ERR" "${bad_arg1}config${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "sh-to-mod" "ERR" "${bad_arg1}sh-to-mod${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "sh-to-mod bash" "ERR" "${bad_arg1}sh-to-mod${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "edit" "ERR" "${bad_arg1}edit${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "edit foo bar" "ERR" "${bad_arg1}edit${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "try-load" "ERR" "${bad_arg1}try-load${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "try-add" "ERR" "${bad_arg1}try-load${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "refresh foo" "ERR" "${bad_arg1}refresh${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "state foo bar" "ERR" "${bad_arg1}state${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "load-any" "ERR" "${bad_arg1}load-any${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "add-any" "ERR" "${bad_arg1}load-any${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "mod-to-sh" "ERR" "${bad_arg1}mod-to-sh${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "mod-to-sh sh" "ERR" "${bad_arg1}mod-to-sh${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "reset foo" "ERR" "${bad_arg1}reset${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "stash foo" "ERR" "${bad_arg1}stash${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "stashpop foo bar" "ERR" "${bad_arg1}stashpop${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "stashrm foo bar" "ERR" "${bad_arg1}stashrm${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "stashshow foo bar" "ERR" "${bad_arg1}stashshow${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "stashclear foo" "ERR" "${bad_arg1}stashclear${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "stashclear foo bar" "ERR" "${bad_arg1}stashclear${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "stashlist foo" "ERR" "${bad_arg1}stashlist${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "stashlist foo bar" "ERR" "${bad_arg1}stashlist${bad_arg2}\n$err_typehelp" testouterr_cmd "sh" "cacheclear foo" "ERR" "${bad_arg1}cacheclear${bad_arg2}\n$err_typehelp" # options valid for some commands are understood as modulefile name elsewhere if {[is_conf_enabled advversspec]} { testouterr_cmd sh {load --append} ERR $err_specmodname'--append' testouterr_cmd sh {load --prepend} ERR $err_specmodname'--prepend' } else { testouterr_cmd sh {load --append} ERR $err_path'--append' testouterr_cmd sh {load --prepend} ERR $err_path'--prepend' } # # Clean up variables used in this test case # unset bad_arg1 unset bad_arg2 unset ans