annotate scripts/testfun/fail.m @ 17384:f0e3d3de5c22

build: Enable subdir-objects Automake option project-wide * configure.ac (AM_INIT_AUTOMAKE): Add subdir-objects option to enable it project-wide to simplify and anticipate future Automake defaults. * libgui/Makefile.am, libinterp/Makefile.am, liboctave/Makefile.am, liboctave/cruft/Makefile.am, scripts/Makefile.am (AUTOMAKE_OPTIONS): Delete.
author Mike Miller <mtmiller@ieee.org>
date Thu, 05 Sep 2013 01:49:29 -0400
parents 70c47da7e02b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13066
diff changeset
1 ## Copyright (C) 2005-2012 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})
14359
7277fe922e99 doc: Use Octave preference for double quote in docstrings in scripts/
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
25 ## @deftypefnx {Function File} {} fail (@var{code}, "warning", @var{pattern})
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
26 ##
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
27 ## Return true if @var{code} fails with an error message matching
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
28 ## @var{pattern}, otherwise produce an error. Note that @var{code}
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
29 ## is a string and if @var{code} runs successfully, the error produced is:
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
30 ##
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
31 ## @example
16190
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
32 ## expected error <.> but got none
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
33 ## @end example
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
34 ##
16190
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
35 ##
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
36 ## Code must be in the form of a string that may be passed by
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
37 ## @code{fail} to the Octave interpreter via the @code{evalin} function,
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
38 ## that is, a (quoted) string constant or a string variable.
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
39 ##
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
40 ## If called with two arguments, the behavior is similar to
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
41 ## @code{fail (@var{code})}, except the return value will only be true if
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
42 ## code fails with an error message containing pattern (case sensitive).
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
43 ## If the code fails with a different error to that given in pattern,
7fe4ea72ba4d doc: Update 'test' and "fail" documentation
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14138
diff changeset
44 ## the message produced is:
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
45 ##
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
46 ## @example
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
47 ## @group
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
48 ## expected <pattern>
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
49 ## but got <text of actual error>
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
50 ## @end group
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
51 ## @end example
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
52 ##
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
53 ## The angle brackets are not part of the output.
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
54 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
55 ## Called with three arguments, the behavior is similar to
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
56 ## @code{fail (@var{code}, @var{pattern})}, but produces an error if no
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
57 ## warning is given during code execution or if the code fails.
12632
2dbac27e0e40 doc: miscellaneous touch-ups to documentation strings
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
58 ## @seealso{assert}
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
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
63 function ret = fail (code, pattern, warning_pattern)
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
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
69 ## sort out 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
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
77 ## match any nonempty message
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
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
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)
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
84 ret = 1;
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.
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
90 lastwarn ();
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
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
95 ## printf ("lastwarn before %s: %s\n",code,lastwarn);
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
96 evalin ("caller", sprintf ("%s;", code));
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
97 ## printf ("lastwarn after %s: %s\n",code,lastwarn);
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
98 ## Retrieve new warnings.
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
99 err = lastwarn ();
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
100 warning (state.state, "quiet");
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
101 if (isempty (err))
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
102 msg = sprintf ("expected warning <%s> but got none", pattern);
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
103 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9051
diff changeset
104 ## Transform "warning: ...\n" to "...".
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
105 err([1:9, end]) = [];
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
106 if (! isempty (regexp (err, pattern, "once")))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9051
diff changeset
107 return;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9051
diff changeset
108 endif
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
109 msg = sprintf ("expected warning <%s>\nbut got <%s>", pattern, err);
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
110 endif
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
111 catch
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
112 warning (state.state, "quiet");
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
113 err = lasterr;
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
114 ## Transform "error: ...\n", to "...".
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
115 err([1:7, end]) = [];
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
116 msg = sprintf ("expected warning <%s> but got error <%s>", pattern, err);
7151
aeeb646f6538 [project @ 2007-11-09 19:34:17 by jwe]
jwe
parents: 7017
diff changeset
117 end_try_catch
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
118
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
119 else
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
120 ## Perform the error test.
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
121 try
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
122 evalin ("caller", sprintf ("%s;", code));
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
123 msg = sprintf ("expected error <%s> but got none", pattern);
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
124 catch
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
125 err = lasterr ();
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
126 if (strcmp (err(1:7), "error:"))
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
127 err([1:6, end]) = []; # transform "error: ...\n", to "..."
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
128 endif
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
129 if (! isempty (regexp (err, pattern, "once")))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9051
diff changeset
130 return;
6494
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
131 endif
76a1a953533d [project @ 2007-04-05 16:09:03 by jwe]
jwe
parents: 6046
diff changeset
132 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
133 end_try_catch
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
134 endif
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
135
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
136 ## 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
137 error (msg);
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 7151
diff changeset
138
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
139 endfunction
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
140
13066
756af8385e26 codesprint: Tests for fail.m
Rik <octave@nomad.inbox5.com>
parents: 12632
diff changeset
141
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
142 %!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
143 %!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
144 %!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
145 %!fail ("warning ('test warning')", "warning", "test warning");
5589
f812a0680d05 [project @ 2006-01-06 00:14:42 by jwe]
jwe
parents:
diff changeset
146
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14363
diff changeset
147 ##% !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
148
13066
756af8385e26 codesprint: Tests for fail.m
Rik <octave@nomad.inbox5.com>
parents: 12632
diff changeset
149 %% Test that fail() itself will generate an error
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
150 %!error fail ("1")
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
151 %!error <undefined> fail ("a*[2;3]", "nonconformant")
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
152 %!error <expected error> 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
153 %!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
154