comparison scripts/testfun/fail.m @ 13066:756af8385e26

codesprint: Tests for fail.m fail.m: Add new error tests.
author Rik <octave@nomad.inbox5.com>
date Sat, 03 Sep 2011 12:02:19 -0700
parents 2dbac27e0e40
children 72c96de7a403
comparison
equal deleted inserted replaced
13065:1ca3cde15b18 13066:756af8385e26
127 ## If we get here, then code didn't fail or error didn't match. 127 ## If we get here, then code didn't fail or error didn't match.
128 error (msg); 128 error (msg);
129 129
130 endfunction 130 endfunction
131 131
132 %!fail ('[1,2]*[2,3]','nonconformant')
133 %!fail ("fail('[1,2]*[2;3]','nonconformant')","expected error <nonconformant> but got none")
134 %!fail ("fail('[1,2]*[2,3]','usage:')","expected error <usage:>\nbut got.*nonconformant")
135 %!fail ("warning('test warning')",'warning','test warning');
136 132
137 %!# fail ("warning('next test')",'warning','next test'); ## only allowed one warning test?!? 133 %!fail ('[1,2]*[2,3]', 'nonconformant')
134 %!fail ("fail('[1,2]*[2;3]', 'nonconformant')", "expected error <nonconformant> but got none")
135 %!fail ("fail('[1,2]*[2,3]','usage:')", "expected error <usage:>\nbut got.*nonconformant")
136 %!fail ("warning('test warning')", 'warning','test warning');
138 137
139 ## Comment out the following tests if you don't want to see what 138 ##% !fail ("warning('next test')",'warning','next test'); ## only allowed one warning test?!?
140 ## errors look like 139
141 % !fail ('a*[2;3]', 'nonconformant') 140 %% Test that fail() itself will generate an error
142 % !fail ('a*[2,3]', 'usage:') 141 %!error fail ("1");
143 % !fail ("warning('warning failure')", 'warning', 'success') 142 %!error <undefined> fail ('a*[2;3]', 'nonconformant')
143 %!error <expected error> fail ('a*[2,3]', 'usage:')
144 %!error <warning failure> fail ("warning('warning failure')", 'warning', 'success')