Mercurial > octave-nkf
annotate test/ctor-vs-method/ctor-vs-method.tst @ 20595:c1a6c31ac29a
eliminate more simple uses of error_state
* ov-classdef.cc: Eliminate simple uses of error_state.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Oct 2015 00:20:02 -0400 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19731
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
1 ## Copyright (C) 2012-2015 John W. Eaton |
13147
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 ## |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 ## |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 ## |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 ## |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 %% Test script for legacy OOP. |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 %% Requires the path to contain the directory ctor-vs-method. |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 %% |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 %% Note: This script and all classes are also intended to run |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 %% in Matlab to test compatibility. Don't break that! |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 %!shared d, o |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 %! d = derived (); |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 %! o = other (); |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 %! |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 %!error method (o); |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 %!test |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 %! ctrace = {'begin parent/method'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 %! 'begin derived/parent'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 %! 'begin parent/parent'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 %! 'end parent/parent'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 %! 'end derived/parent'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 %! 'end parent/method'}; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 %! __trace__ (); %% clear call trace info |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 %! method (d); |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 %! assert (__trace__ (), ctrace); |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 %!test |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 %! ctrace = {'begin other/parent'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 %! 'end other/parent'}; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 %! __trace__ (); %% clear call trace info |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 %! parent (o); |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 %! assert (__trace__ (), ctrace); |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 %!test |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 %! ctrace = {'begin derived/parent'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 %! 'begin parent/parent'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 %! 'end parent/parent'; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 %! 'end derived/parent'}; |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 %! __trace__ (); %% clear call trace info |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 %! parent (d); |
6c952376482d
look for methods before constructors
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 %! assert (__trace__ (), ctrace); |