annotate scripts/testfun/fail.m @ 20144:2d5cbb6ac845

fail.m: Use internal variable name in BIST test (bug #44525). * fail.m: Rename variable 'a' to '__a__' in case there is an a.m m-file.
author Rik <rik@octave.org>
date Thu, 12 Mar 2015 15:00:32 -0700
parents 9fc020886ae9
children 64a2d4c87ecb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19898
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19207
diff changeset
1 ## Copyright (C) 2005-2015 Paul Kienzle
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
2 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
3 ## This file is part of Octave.
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
4 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
6 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
8 ## your option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
9 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
13 ## General Public License for more details.
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
14 ##
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
17 ## <http://www.gnu.org/licenses/>.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
18 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
19 ## Original version by Paul Kienzle distributed as free software in the
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6494
diff changeset
20 ## public domain.
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
21
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
22 ## -*- texinfo -*-
12632
2dbac27e0e40 doc: miscellaneous touch-ups to documentation strings
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
23 ## @deftypefn {Function File} {} fail (@var{code})
2dbac27e0e40 doc: miscellaneous touch-ups to documentation strings
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
24 ## @deftypefnx {Function File} {} fail (@var{code}, @var{pattern})
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
25 ## @deftypefnx {Function File} {} fail (@var{code}, "warning")
14359
7277fe922e99 doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
26 ## @deftypefnx {Function File} {} fail (@var{code}, "warning", @var{pattern})
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
27 ##
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
28 ## Return true if @var{code} fails with an error message matching
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
29 ## @var{pattern}, otherwise produce an error.
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
30 ##
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
31 ## @var{code} must be in the form of a string that is passed to the Octave
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
32 ## interpreter via the @code{evalin} function, i.e., a (quoted) string constant
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
33 ## or a string variable.
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
34 ##
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
35 ## Note that if @var{code} runs successfully, rather than failing, the error
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
36 ## printed is:
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
37 ##
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
38 ## @example
16190
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
39 ## expected error <.> but got none
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
40 ## @end example
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
41 ##
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
42 ## If called with two arguments, the return value will be true only if
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
43 ## @var{code} fails with an error message containing @var{pattern}
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
44 ## (case sensitive). If the code fails with a different error than the one
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
45 ## specified in @var{pattern} then the message produced is:
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
46 ##
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
47 ## @example
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
48 ## @group
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
49 ## expected <@var{pattern}>
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
50 ## but got <text of actual error>
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
51 ## @end group
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
52 ## @end example
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
53 ##
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
54 ## The angle brackets are not part of the output.
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
55 ##
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
56 ## When called with the @qcode{"warning"} option @code{fail} will produce
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
57 ## an error if executing the code produces no warning.
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
58 ## @seealso{assert, error}
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
59 ## @end deftypefn
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
60
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
61 ## Author: Paul Kienzle <pkienzle@users.sf.net>
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
62
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
63 function retval = fail (code, pattern, warning_pattern)
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
64
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
65 if (nargin < 1 || nargin > 3)
6046
34f96dd5441b [project @ 2006-10-10 16:10:25 by jwe]
jwe
parents: 5589
diff changeset
66 print_usage ();
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
67 endif
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
68
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
69 ## Parse input arguments
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
70 test_warning = (nargin > 1 && strcmp (pattern, "warning"));
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
71 if (nargin == 3)
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
72 pattern = warning_pattern;
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 8506
diff changeset
73 elseif (nargin == 1 || (nargin == 2 && test_warning))
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
74 pattern = "";
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
75 endif
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
76
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
77 ## Match any nonempty message
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
78 if (isempty (pattern))
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
79 pattern = ".";
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
80 endif
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
81
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
82 ## Allow assert (fail ())
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
83 if (nargout)
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
84 retval = true;
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
85 endif
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
86
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
87 if (test_warning)
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
88 ## Perform the warning test.
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
89 ## Clear old warnings.
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
90 lastwarn ("");
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
91 ## Make sure warnings are turned on.
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
92 state = warning ("query", "quiet");
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
93 warning ("on", "quiet");
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
94 try
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
95 evalin ("caller", [code ";"]);
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
96 ## Retrieve new warnings.
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
97 warn = lastwarn ();
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
98 warning (state.state, "quiet");
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
99 if (isempty (warn))
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
100 msg = sprintf ("expected warning <%s> but got none", pattern);
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
101 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9051
diff changeset
102 ## Transform "warning: ...\n" to "...".
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
103 warn([1:9, end]) = [];
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
104 if (! isempty (regexp (warn, pattern, "once")))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9051
diff changeset
105 return;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9051
diff changeset
106 endif
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
107 msg = sprintf ("expected warning <%s>\nbut got <%s>", pattern, warn);
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
108 endif
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
109 catch
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
110 warning (state.state, "quiet");
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
111 err = lasterr;
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
112 ## Transform "error: ...\n", to "...".
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
113 err([1:6, end]) = [];
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
114 msg = sprintf ("expected warning <%s>\nbut got error <%s>", pattern, err);
7151
aeeb646f6538 [project @ 2007-11-09 19:34:17 by jwe]
jwe
parents: 7017
diff changeset
115 end_try_catch
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
116
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
117 else
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
118 ## Perform the error test.
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
119 try
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
120 evalin ("caller", [code ";"]);
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
121 msg = sprintf ("expected error <%s> but got none", pattern);
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
122 catch
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
123 err = lasterr ();
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
124 if (strcmp (err(1:7), "error:"))
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
125 err([1:6, end]) = []; # transform "error: ...\n", to "..."
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
126 endif
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
127 if (! isempty (regexp (err, pattern, "once")))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9051
diff changeset
128 return;
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
129 endif
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
130 msg = sprintf ("expected error <%s>\nbut got <%s>", pattern, err);
7151
aeeb646f6538 [project @ 2007-11-09 19:34:17 by jwe]
jwe
parents: 7017
diff changeset
131 end_try_catch
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
132 endif
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
133
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
134 ## If we get here, then code didn't fail or error didn't match.
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
135 error (msg);
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
136
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
137 endfunction
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
138
13066
756af8385e26 codesprint: Tests for fail.m
Rik <octave@nomad.inbox5.com>
parents: 12632
diff changeset
139
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
140 %!fail ("[1,2]*[2,3]", "nonconformant")
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
141 %!fail ("fail ('[1,2]*[2;3]', 'nonconformant')", "expected error <nonconformant> but got none")
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
142 %!fail ("fail ('[1,2]*[2,3]', 'usage:')", "expected error <usage:>\nbut got.*nonconformant")
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
143 %!fail ("warning ('test warning')", "warning", "test warning");
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
144
20038
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19898
diff changeset
145 #%!fail ("warning ('next test')",'warning','next test'); # only allowed one warning test?!?
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
146
20038
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19898
diff changeset
147 ## Test that fail() itself will generate an error
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
148 %!error <expected error> fail ("1")
20144
2d5cbb6ac845 fail.m: Use internal variable name in BIST test (bug #44525).
Rik <rik@octave.org>
parents: 20038
diff changeset
149 %!error <'__a__' undefined> fail ("__a__*[2;3]", "nonconformant")
2d5cbb6ac845 fail.m: Use internal variable name in BIST test (bug #44525).
Rik <rik@octave.org>
parents: 20038
diff changeset
150 %!error <expected error .usage:> fail ("__a__*[2,3]", "usage:")
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
151 %!error <warning failure> fail ("warning ('warning failure')", "warning", "success")
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
152
20038
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19898
diff changeset
153 ## Test input validation
19207
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
154 %!error fail ()
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
155 %!error fail (1,2,3,4)
ffa20d287355 fail.m: Overhaul function and return logical true rather than double (1).
Rik <rik@octave.org>
parents: 17744
diff changeset
156