Mercurial > octave-nkf
annotate test/line-continue.tst @ 17668:171e958d672e
line-continue.tst: Add tests for '\' used in strings.
* test/line-continue.tst: Add tests for '\' used in strings.
Add note about removing tests for '\' as a line continuation because
it is now deprecated.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 16 Oct 2013 12:16:08 -0700 |
parents | 8be8a65d3ca8 |
children | 4e5c17b3294a |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14132
diff
changeset
|
1 ## Copyright (C) 2006-2012 John W. Eaton |
7016 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
19 %!shared x, a, b |
5590 | 20 %! x = [1,2]; |
21 %! a = 1; | |
22 %! b = 2; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
23 |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
24 %!test |
5590 | 25 %! y = [a... # comments here ok |
26 %! b]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
27 %! assert (y, x); |
5590 | 28 |
17668
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
29 ## FIXME: Next 3 tests use '\' continuation outside of a double-quoted string |
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
30 ## This behavior is deprecated and will be removed at some point. |
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
31 ## When it does these |
5590 | 32 %!test |
33 %! x = [1;2]; | |
34 %! y = [a... # comments here ok | |
35 %! ;\ | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
36 %! |
5590 | 37 %! b]; |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
38 %! assert (y, x); |
5590 | 39 |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
40 %!assert (1 + ... |
5590 | 41 %! 2 - \# comments here ok |
42 %! 3 / ... # comments here ok | |
43 %! -1,6); | |
44 | |
45 %!function y = f (a,... | |
46 %! b, ... | |
47 %! c, ... % comments ok | |
48 %! x, # continuation characters not required in parens | |
49 %! y, \# but they should work too. | |
50 %! z) | |
51 %! | |
52 %! y = 1; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
53 %!endfunction |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
54 %! |
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
55 %!assert (f (), 1) |
5590 | 56 |
17668
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
57 # String continuation using '\' |
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
58 %!assert (["abc\ |
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
59 %! def"], "abc def") |
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
60 |
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
61 %!assert (['abc\ |
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
62 %! def'], "abc def") |
171e958d672e
line-continue.tst: Add tests for '\' used in strings.
Rik <rik@octave.org>
parents:
17246
diff
changeset
|
63 |
5590 | 64 %!test |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
65 %!assert (1 == 1 |
5590 | 66 %! && 2 == 2 |
67 %! || 3 == 5); | |
68 | |
69 %!test | |
70 %! x = [1, ... | |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
71 %! |
5590 | 72 %! ... |
16215
6fe6ac8bbfdb
test: Remove trailing spaces from ends of lines in test/ directory.
Rik <rik@octave.org>
parents:
16030
diff
changeset
|
73 %! |
5590 | 74 %! 2]; |
75 %! y = [1;2]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
76 %! assert (y, x); |
5590 | 77 |
78 %!test | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
79 %! x = [1 ,... |
5590 | 80 %! 2]; |
81 %! y = [1,2]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
82 %! assert (y, x); |
5590 | 83 |
84 %!test | |
85 %! x = [ 1 , ... | |
86 %! 2]; | |
87 %! y = [1,2]; | |
14131
c3309e1ec50d
test: Use Octave coding and spacing conventions for fixed test scripts
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
88 %! assert (y, x); |
5590 | 89 |
17246
8be8a65d3ca8
Ignore anything after the continuation marker '...' (bug #38653)
Stefan Mahr <dac922@gmx.de>
parents:
16937
diff
changeset
|
90 %!test |
8be8a65d3ca8
Ignore anything after the continuation marker '...' (bug #38653)
Stefan Mahr <dac922@gmx.de>
parents:
16937
diff
changeset
|
91 %! x = [ 1 , ...anything after the ... is ignored |
8be8a65d3ca8
Ignore anything after the continuation marker '...' (bug #38653)
Stefan Mahr <dac922@gmx.de>
parents:
16937
diff
changeset
|
92 %! 2]; |
8be8a65d3ca8
Ignore anything after the continuation marker '...' (bug #38653)
Stefan Mahr <dac922@gmx.de>
parents:
16937
diff
changeset
|
93 %! y = [1,2]; |
8be8a65d3ca8
Ignore anything after the continuation marker '...' (bug #38653)
Stefan Mahr <dac922@gmx.de>
parents:
16937
diff
changeset
|
94 %! assert (y, x); |