Debian Codegraph @

testsuite/modules.00-init/071-args.exp

raw
1 ##############################################################################
2 # Modules Revision 3.0
3 # Providing a flexible user environment
4 #
5 # File: modules.00-init/%M%
6 # Revision: %I%
7 # First Edition: 2016/08/28
8 # Last Mod.: %U%, %G%
9 #
10 # Authors: Xavier Delaruelle, [email protected]
11 #
12 # Description: Testuite testsequence
13 # Command:
14 # Sub-Command:
15 #
16 # Comment: %C{
17 # Check module commands against wrong argument number.
18 # }C%
19 #
20 ##############################################################################
21
22 #
23 # The following answers are to be expected in this testcase ...
24 #
25
26 set bad_arg1 "$error_msgs: Unexpected number of args for '"
27 set bad_arg2 "' command"
28
29
30 #
31 # The tests
32 #
33
34 if {$verbose} {
35 send_user "\tChecking commands against wrong argument number...\n"
36 }
37
38 # empty argument list on load command does not lead to error (nop)
39 testouterr_cmd "sh" "load" "OK" ""
40
41 # check first arg is split internally for argument list passed as a single string
42 lappend ans [list set __MODULES_LMALTNAME "loc_dv2/1.0&loc_dv2/default&loc_dv2"]
43 lappend ans [list set _LMFILES_ "$modpath/loc_dv2/1.0"]
44 lappend ans [list set LOADEDMODULES "loc_dv2/1.0"]
45 testouterr_cmd "sh" "NOCMDSPLITload loc_dv2/1.0" $ans ""
46
47 # unexpected number of arguments leads to error code
48 testouterr_cmd "ALL" "unload" "ERR" "${bad_arg1}unload${bad_arg2}\n$err_typehelp"
49
50 # only check sh shell for the remaining test, as we already test above
51 # that every supported shells respond correctly to error raise
52
53 testall_cmd "sh" "reload foo" "ERR" "${bad_arg1}reload${bad_arg2}\n$err_typehelp" 1
54 testall_cmd "sh" "update foo" "ERR" "${bad_arg1}reload${bad_arg2}\n$err_typehelp" 1
55 testouterr_cmd "sh" "source" "ERR" "${bad_arg1}source${bad_arg2}\n$err_typehelp"
56 testouterr_cmd "sh" "switch" "ERR" "${bad_arg1}switch${bad_arg2}\n$err_typehelp"
57 testouterr_cmd "sh" "switch foo1 bar foo2" "ERR" "${bad_arg1}switch${bad_arg2}\n$err_typehelp"
58 testouterr_cmd "sh" "show" "ERR" "${bad_arg1}display${bad_arg2}\n$err_typehelp"
59 testouterr_cmd "sh" "display" "ERR" "${bad_arg1}display${bad_arg2}\n$err_typehelp"
60 testouterr_cmd "sh" "aliases foo" "ERR" "${bad_arg1}aliases${bad_arg2}\n$err_typehelp"
61 testouterr_cmd "sh" "path" "ERR" "${bad_arg1}path${bad_arg2}\n$err_typehelp"
62 testouterr_cmd "sh" "path foo bar" "ERR" "${bad_arg1}path${bad_arg2}\n$err_typehelp"
63 testouterr_cmd "sh" "paths" "ERR" "${bad_arg1}paths${bad_arg2}\n$err_typehelp"
64 testouterr_cmd "sh" "paths foo bar" "ERR" "${bad_arg1}paths${bad_arg2}\n$err_typehelp"
65 testouterr_cmd "sh" "search foo bar" "ERR" "${bad_arg1}search${bad_arg2}\n$err_typehelp"
66 testouterr_cmd "sh" "purge foo" "ERR" "${bad_arg1}purge${bad_arg2}\n$err_typehelp"
67 testouterr_cmd "sh" "save foo bar" "ERR" "${bad_arg1}save${bad_arg2}\n$err_typehelp"
68 testouterr_cmd "sh" "restore foo bar" "ERR" "${bad_arg1}restore${bad_arg2}\n$err_typehelp"
69 testouterr_cmd "sh" "saverm foo bar" "ERR" "${bad_arg1}saverm${bad_arg2}\n$err_typehelp"
70 testouterr_cmd "sh" "disable foo bar" "ERR" "${bad_arg1}saverm${bad_arg2}\n$err_typehelp"
71 testouterr_cmd "sh" "saveshow foo bar" "ERR" "${bad_arg1}saveshow${bad_arg2}\n$err_typehelp"
72 testouterr_cmd "sh" "describe foo bar" "ERR" "${bad_arg1}saveshow${bad_arg2}\n$err_typehelp"
73 testouterr_cmd "sh" "initadd" "ERR" "${bad_arg1}initadd${bad_arg2}\n$err_typehelp"
74 testouterr_cmd "sh" "initprepend" "ERR" "${bad_arg1}initprepend${bad_arg2}\n$err_typehelp"
75 testouterr_cmd "sh" "initswitch" "ERR" "${bad_arg1}initswitch${bad_arg2}\n$err_typehelp"
76 testouterr_cmd "sh" "initswitch foo1 bar foo2" "ERR" "${bad_arg1}initswitch${bad_arg2}\n$err_typehelp"
77 testouterr_cmd "sh" "initrm" "ERR" "${bad_arg1}initrm${bad_arg2}\n$err_typehelp"
78 testouterr_cmd "sh" "initlist foo" "ERR" "${bad_arg1}initlist${bad_arg2}\n$err_typehelp"
79 testouterr_cmd "sh" "initclear foo" "ERR" "${bad_arg1}initclear${bad_arg2}\n$err_typehelp"
80 testouterr_cmd "sh" "autoinit foo" "ERR" "${bad_arg1}autoinit${bad_arg2}\n$err_typehelp"
81 testouterr_cmd "sh" "test" "ERR" "${bad_arg1}test${bad_arg2}\n$err_typehelp"
82 testouterr_cmd "sh" "append-path" "ERR" "${bad_arg1}append-path${bad_arg2}\n$err_typehelp"
83 testouterr_cmd "sh" "prepend-path" "ERR" "${bad_arg1}prepend-path${bad_arg2}\n$err_typehelp"
84 testouterr_cmd "sh" "remove-path" "ERR" "${bad_arg1}remove-path${bad_arg2}\n$err_typehelp"
85 testouterr_cmd "sh" "is-avail" "ERR" "${bad_arg1}is-avail${bad_arg2}\n$err_typehelp"
86 testouterr_cmd "sh" "info-loaded" "ERR" "${bad_arg1}info-loaded${bad_arg2}\n$err_typehelp"
87 testouterr_cmd "sh" "config foo bar foo" "ERR" "${bad_arg1}config${bad_arg2}\n$err_typehelp"
88 testouterr_cmd "sh" "sh-to-mod" "ERR" "${bad_arg1}sh-to-mod${bad_arg2}\n$err_typehelp"
89 testouterr_cmd "sh" "sh-to-mod bash" "ERR" "${bad_arg1}sh-to-mod${bad_arg2}\n$err_typehelp"
90 testouterr_cmd "sh" "edit" "ERR" "${bad_arg1}edit${bad_arg2}\n$err_typehelp"
91 testouterr_cmd "sh" "edit foo bar" "ERR" "${bad_arg1}edit${bad_arg2}\n$err_typehelp"
92 testouterr_cmd "sh" "try-load" "ERR" "${bad_arg1}try-load${bad_arg2}\n$err_typehelp"
93 testouterr_cmd "sh" "try-add" "ERR" "${bad_arg1}try-load${bad_arg2}\n$err_typehelp"
94 testouterr_cmd "sh" "refresh foo" "ERR" "${bad_arg1}refresh${bad_arg2}\n$err_typehelp"
95 testouterr_cmd "sh" "state foo bar" "ERR" "${bad_arg1}state${bad_arg2}\n$err_typehelp"
96 testouterr_cmd "sh" "load-any" "ERR" "${bad_arg1}load-any${bad_arg2}\n$err_typehelp"
97 testouterr_cmd "sh" "add-any" "ERR" "${bad_arg1}load-any${bad_arg2}\n$err_typehelp"
98 testouterr_cmd "sh" "mod-to-sh" "ERR" "${bad_arg1}mod-to-sh${bad_arg2}\n$err_typehelp"
99 testouterr_cmd "sh" "mod-to-sh sh" "ERR" "${bad_arg1}mod-to-sh${bad_arg2}\n$err_typehelp"
100 testouterr_cmd "sh" "reset foo" "ERR" "${bad_arg1}reset${bad_arg2}\n$err_typehelp"
101 testouterr_cmd "sh" "stash foo" "ERR" "${bad_arg1}stash${bad_arg2}\n$err_typehelp"
102 testouterr_cmd "sh" "stashpop foo bar" "ERR" "${bad_arg1}stashpop${bad_arg2}\n$err_typehelp"
103 testouterr_cmd "sh" "stashrm foo bar" "ERR" "${bad_arg1}stashrm${bad_arg2}\n$err_typehelp"
104 testouterr_cmd "sh" "stashshow foo bar" "ERR" "${bad_arg1}stashshow${bad_arg2}\n$err_typehelp"
105 testouterr_cmd "sh" "stashclear foo" "ERR" "${bad_arg1}stashclear${bad_arg2}\n$err_typehelp"
106 testouterr_cmd "sh" "stashclear foo bar" "ERR" "${bad_arg1}stashclear${bad_arg2}\n$err_typehelp"
107 testouterr_cmd "sh" "stashlist foo" "ERR" "${bad_arg1}stashlist${bad_arg2}\n$err_typehelp"
108 testouterr_cmd "sh" "stashlist foo bar" "ERR" "${bad_arg1}stashlist${bad_arg2}\n$err_typehelp"
109 testouterr_cmd "sh" "cacheclear foo" "ERR" "${bad_arg1}cacheclear${bad_arg2}\n$err_typehelp"
110
111
112 # options valid for some commands are understood as modulefile name elsewhere
113 if {[is_conf_enabled advversspec]} {
114 testouterr_cmd sh {load --append} ERR $err_specmodname'--append'
115 testouterr_cmd sh {load --prepend} ERR $err_specmodname'--prepend'
116 } else {
117 testouterr_cmd sh {load --append} ERR $err_path'--append'
118 testouterr_cmd sh {load --prepend} ERR $err_path'--prepend'
119 }
120
121 #
122 # Clean up variables used in this test case
123 #
124
125 unset bad_arg1
126 unset bad_arg2
127 unset ans