branch: externals/matlab-mode
commit fa0fc18983afeeed9cea15a99860874acd783f85
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: improve line-by-line indent testing
---
.../indent_cont_statement_error.m | 13 +++++++++++++
.../indent_cont_statement_error_expected.m | 13 +++++++++++++
.../indent_cont_statements.m | 22 ++++++++--------------
.../indent_cont_statements.skip.typing.txt | 1 -
.../indent_cont_statements_expected.m | 22 ++++++++--------------
5 files changed, 42 insertions(+), 29 deletions(-)
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_cont_statement_error.m
b/tests/test-matlab-ts-mode-indent-files/indent_cont_statement_error.m
new file mode 100644
index 0000000000..ddb7e6afc8
--- /dev/null
+++ b/tests/test-matlab-ts-mode-indent-files/indent_cont_statement_error.m
@@ -0,0 +1,13 @@
+% -*- matlab-ts -*-
+%
+% t-utils-test-indent: no-line-by-line-indent - typing the incomplete
expression line-by-line
+% results in a parse tree that can't match below.
+%
+function a=indent_cont_statement_error
+ % The matlab-tree-sitter, by design for simplicity treats "..." as
comments so the following
+ % is an error in MATLAB, but doesn't generate a parse error and indents
the same as if
+ % the ellipsis (...) were present.
+ a =
+ 1 +
+ 2;
+end
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_cont_statement_error_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_cont_statement_error_expected.m
new file mode 100644
index 0000000000..393dc5edff
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_cont_statement_error_expected.m
@@ -0,0 +1,13 @@
+% -*- matlab-ts -*-
+%
+% t-utils-test-indent: no-line-by-line-indent - typing the incomplete
expression line-by-line
+% results in a parse tree that can't match below.
+%
+function a=indent_cont_statement_error
+% The matlab-tree-sitter, by design for simplicity treats "..." as comments so
the following
+% is an error in MATLAB, but doesn't generate a parse error and indents the
same as if
+% the ellipsis (...) were present.
+ a =
+ 1 +
+ 2;
+end
diff --git a/tests/test-matlab-ts-mode-indent-files/indent_cont_statements.m
b/tests/test-matlab-ts-mode-indent-files/indent_cont_statements.m
index 4622afe840..6f59770d3c 100644
--- a/tests/test-matlab-ts-mode-indent-files/indent_cont_statements.m
+++ b/tests/test-matlab-ts-mode-indent-files/indent_cont_statements.m
@@ -1,25 +1,25 @@
% -*- matlab-ts -*-
-function a = indent_cont_statements
+function out = indent_cont_statements
a = ...
1;
- a = ...
+ b = ...
1 + ...
2 + ...
2;
- a = 2 * ...
+ c = 2 * ...
1;
- a = ( ...
+ d = ( ...
1 + 2);
- a = ( ...
+ e = ( ...
1 ...
);
- a = 2 * ...
+ f = 2 * ...
( ...
3 + ...
4 + ( ...
@@ -28,14 +28,8 @@ function a = indent_cont_statements
) ...
); ...
- a = 1 + 2;
-
- % The matlab-tree-sitter, by design for simplicity treats "..." as
comments so the following
- % is an error in MATLAB, but doesn't generate a parse error and indents
the same as if
- % the ellipsis (...) were present.
- a =
- 1 +
- 2;
+ g = 1 + 2;
+ out = a + b + c + d + e + f + g;
end
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_cont_statements.skip.typing.txt
b/tests/test-matlab-ts-mode-indent-files/indent_cont_statements.skip.typing.txt
deleted file mode 100644
index 6d9c24a567..0000000000
---
a/tests/test-matlab-ts-mode-indent-files/indent_cont_statements.skip.typing.txt
+++ /dev/null
@@ -1 +0,0 @@
-Some comments not indented correctly.
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_cont_statements_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_cont_statements_expected.m
index 667a88cfc4..66d1c963c9 100644
--- a/tests/test-matlab-ts-mode-indent-files/indent_cont_statements_expected.m
+++ b/tests/test-matlab-ts-mode-indent-files/indent_cont_statements_expected.m
@@ -1,25 +1,25 @@
% -*- matlab-ts -*-
-function a = indent_cont_statements
+function out = indent_cont_statements
a = ...
1;
- a = ...
+ b = ...
1 + ...
2 + ...
2;
- a = 2 * ...
+ c = 2 * ...
1;
- a = ( ...
+ d = ( ...
1 + 2);
- a = ( ...
+ e = ( ...
1 ...
);
- a = 2 * ...
+ f = 2 * ...
( ...
3 + ...
4 + ( ...
@@ -28,14 +28,8 @@ function a = indent_cont_statements
) ...
); ...
- a = 1 + 2;
-
- % The matlab-tree-sitter, by design for simplicity treats "..." as
comments so the following
- % is an error in MATLAB, but doesn't generate a parse error and indents
the same as if
- % the ellipsis (...) were present.
- a =
- 1 +
- 2;
+ g = 1 + 2;
+ out = a + b + c + d + e + f + g;
end