Mercurial > octave-antonio
comparison scripts/miscellaneous/license.m @ 19833:9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Try to trim long lines to < 80 chars.
Use '##' for single line comments.
Use '(...)' around tests for if/elseif/switch/while.
Abut cell indexing operator '{' next to variable.
Abut array indexing operator '(' next to variable.
Use space between negation operator '!' and following expression.
Use two newlines between endfunction and start of %!test or %!demo code.
Remove unnecessary parens grouping between short-circuit operators.
Remove stray extra spaces (typos) between variables and assignment operators.
Remove stray extra spaces from ends of lines.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 23 Feb 2015 14:54:39 -0800 |
parents | 4197fc428c7d |
children |
comparison
equal
deleted
inserted
replaced
19832:a1acca0c2216 | 19833:9fc020886ae9 |
---|---|
100 | 100 |
101 if (nargin > 2) | 101 if (nargin > 2) |
102 ## We ignore the toogle argument because... what's the point? We | 102 ## We ignore the toogle argument because... what's the point? We |
103 ## don't need a license management system on Octave. This function | 103 ## don't need a license management system on Octave. This function |
104 ## will return true, even if anyone tries to disabled a license. | 104 ## will return true, even if anyone tries to disabled a license. |
105 switch tolower (toogle) | 105 switch (tolower (toogle)) |
106 case "enable" # do nothing | 106 case "enable" # do nothing |
107 case "disable" # do nothing | 107 case "disable" # do nothing |
108 otherwise error ("license: TOOGLE must be enable or disable"); | 108 otherwise error ("license: TOOGLE must be enable or disable"); |
109 endswitch | 109 endswitch |
110 endif | 110 endif |
179 | 179 |
180 %!test | 180 %!test |
181 %! [s, e] = license ("checkout", "NOT_A_PACKAGE"); | 181 %! [s, e] = license ("checkout", "NOT_A_PACKAGE"); |
182 %! assert (e, 'No package named "NOT_A_PACKAGE" installed'); | 182 %! assert (e, 'No package named "NOT_A_PACKAGE" installed'); |
183 | 183 |
184 %% Test input validation | 184 ## Test input validation |
185 %!error license ("not_inuse") | 185 %!error license ("not_inuse") |
186 %!error license ("not_test", "octave", "enable") | 186 %!error license ("not_test", "octave", "enable") |
187 %!error <TOOGLE must be enable or disable> license ("test", "octave", "invalid_toogle") | 187 %!error <TOOGLE must be enable or disable> license ("test", "octave", "invalid_toogle") |
188 | 188 |