branch: externals/matlab-mode
commit 43a7a7c57e45ec6515c818c0d7e789d5046bf583
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>

    matlab-ts-mode: add test for comma with line continuations in cell
---
 .../indent_line_cont_in_cell_with_comma.m          | 24 ++++++++++++++++++++++
 .../indent_line_cont_in_cell_with_comma_expected.m | 24 ++++++++++++++++++++++
 ...nt_line_cont_in_cell_with_comma_expected_msgs.m | 24 ++++++++++++++++++++++
 3 files changed, 72 insertions(+)

diff --git 
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma.m 
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma.m
new file mode 100644
index 0000000000..8a03f30aac
--- /dev/null
+++ 
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma.m
@@ -0,0 +1,24 @@
+% -*- matlab-ts -*-
+
+% t-utils-test-indent: no-line-by-line-indent - "} ..." is not handled 
correctly
+
+someFcn(...
+    'arg1', ...
+    ... comment1
+    '-foo1', ...
+    {
+      ... comment 2
+      {'foo2', ...
+       '-foo3', ...
+       @(f)cmd([a '/' b 'c'], 'foo4', 'on'), ...
+       '-foo5', {'x'}, ...
+      } ...
+      ...
+      , ... comment
+      {'foo', ...
+       'bar'} ...
+    });
+
+function someFcn(varargin)
+    disp(varargin);
+end
diff --git 
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma_expected.m
 
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma_expected.m
new file mode 100644
index 0000000000..8a03f30aac
--- /dev/null
+++ 
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma_expected.m
@@ -0,0 +1,24 @@
+% -*- matlab-ts -*-
+
+% t-utils-test-indent: no-line-by-line-indent - "} ..." is not handled 
correctly
+
+someFcn(...
+    'arg1', ...
+    ... comment1
+    '-foo1', ...
+    {
+      ... comment 2
+      {'foo2', ...
+       '-foo3', ...
+       @(f)cmd([a '/' b 'c'], 'foo4', 'on'), ...
+       '-foo5', {'x'}, ...
+      } ...
+      ...
+      , ... comment
+      {'foo', ...
+       'bar'} ...
+    });
+
+function someFcn(varargin)
+    disp(varargin);
+end
diff --git 
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma_expected_msgs.m
 
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma_expected_msgs.m
new file mode 100644
index 0000000000..2cb18ca966
--- /dev/null
+++ 
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_in_cell_with_comma_expected_msgs.m
@@ -0,0 +1,24 @@
+% -*- matlab-ts -*- %  <{Matched rule: ((lambda (node parent _bol &rest _) 
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal 
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _) 
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+
+% t-utils-test-indent: no-line-by-line-indent - "} ..." is not handled 
correctly %  <{Matched rule: ((lambda (node parent _bol &rest _) (and node (not 
(string= (treesit-node-type node) "line_continuation")) (equal 
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _) 
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+
+someFcn(... %  <{Matched rule: ((lambda (node parent _bol &rest _) (and node 
(not (string= (treesit-node-type node) "line_continuation")) (equal 
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _) 
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+    'arg1', ... %  <{Matched rule: ((node-is "\\`arguments\\'") parent 4)}>
+    ... comment1 %  <{Matched rule: ((parent-is "\\`arguments\\'") parent 0)}>
+    '-foo1', ... %  <{Matched rule: ((parent-is "\\`arguments\\'") parent 0)}>
+    { %  <{Matched rule: ((parent-is "\\`arguments\\'") parent 0)}>
+      ... comment 2 %  <{Matched rule: ((parent-is 
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
+      {'foo2', ... %  <{Matched rule: ((parent-is 
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
+       '-foo3', ... %  <{Matched rule: ((parent-is 
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+       @(f)cmd([a '/' b 'c'], 'foo4', 'on'), ... %  <{Matched rule: 
((parent-is "\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+       '-foo5', {'x'}, ... %  <{Matched rule: ((parent-is 
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+      } ... %  <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
+      ... %  <{Matched rule: ((parent-is 
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+      , ... comment %  <{Matched rule: ((parent-is 
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+      {'foo', ... %  <{Matched rule: ((parent-is 
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+       'bar'} ... %  <{Matched rule: ((parent-is 
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+    }); %  <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
+
+function someFcn(varargin) %  <{Matched rule: ((lambda (node parent _bol &rest 
_) (and node (not (string= (treesit-node-type node) "line_continuation")) 
(equal (treesit-node-type parent) "source_file"))) (lambda (_node _parent bol 
&rest _) (save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+    disp(varargin); %  <{Matched rule: ((parent-is 
"\\`function_definition\\'") parent 
matlab-ts-mode--set-function-indent-level-for-gp)}>
+end %  <{Matched rule: ((node-is 
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'") 
parent 0)}>

Reply via email to