1########################################################################
2##
3## Copyright (C) 2006-2021 The Octave Project Developers
4##
5## See the file COPYRIGHT.md in the top-level directory of this
6## distribution or <https://octave.org/copyright/>.
7##
8## This file is part of Octave.
9##
10## Octave is free software: you can redistribute it and/or modify it
11## under the terms of the GNU General Public License as published by
12## the Free Software Foundation, either version 3 of the License, or
13## (at your option) any later version.
14##
15## Octave is distributed in the hope that it will be useful, but
16## WITHOUT ANY WARRANTY; without even the implied warranty of
17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18## GNU General Public License for more details.
19##
20## You should have received a copy of the GNU General Public License
21## along with Octave; see the file COPYING.  If not, see
22## <https://www.gnu.org/licenses/>.
23##
24########################################################################
25
26%!shared x, a, b
27%! x = [1,2];
28%! a = 1;
29%! b = 2;
30
31%!test
32%! y = [a... # comments here ok
33%! b];
34%! assert (y, x);
35
36## FIXME: Next 3 tests use '\' continuation outside of a double-quoted string
37##        This behavior is deprecated and will be removed at some point.
38##        When it does these
39%!test
40%! x = [1;2];
41%! y = [a... # comments here ok
42%! ;\
43%!
44%! b];
45%! assert (y, x);
46
47%!assert (1 + ...
48%! 2 - \# comments here ok
49%! 3 / ... # comments here ok
50%! -1,6);
51
52%!function y = f (a,...
53%!                b,  ...
54%!                c,  ...   % comments ok
55%!                x,  # continuation characters not required in parens
56%!                y,  \# but they should work too.
57%!                z)
58%!
59%!  y = 1;
60%!endfunction
61%!
62%!assert (f (), 1)
63
64# String continuation using '\'
65%!assert (["abc\
66%! def"], "abc def")
67
68%!test
69%!assert (1 == 1
70%! && 2 == 2
71%! || 3 == 5);
72
73%!test
74%! x = [1, ...
75%!
76%! ...
77%!
78%! 2];
79%! y = [1;2];
80%! assert (y, x);
81
82%!test
83%! x = [1 ,...
84%! 2];
85%! y = [1,2];
86%! assert (y, x);
87
88%!test
89%! x = [ 1 , ...
90%! 2];
91%! y = [1,2];
92%! assert  (y, x);
93
94%!test
95%! x = [ 1 , ...anything after the ... is ignored
96%! 2];
97%! y = [1,2];
98%! assert  (y, x);
99