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

    matlab-ts-mode: remove indent to do item and add test
---
 matlab-ts-mode.el                                  | 13 ----
 .../indent_xr_fun2.m                               | 11 +++
 .../indent_xr_fun2_expected.org                    | 80 ++++++++++++++++++++++
 3 files changed, 91 insertions(+), 13 deletions(-)

diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index 5a45679f8f..863ff8fe36 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -2578,19 +2578,6 @@ is t, add the following to an Init File (e.g. 
`user-init-file' or
     ;; TODO double check t-utils.el help, extract the help and put in treesit 
how to
     ;;
     ;; TODO indent
-    ;;      function outResult = foo
-    ;;                  outResult = longFunction(...    <== TAB should shift, 
w/o "..." it shifts
-    ;;      end
-    ;;      Requires ERROR node be located under the function_output.
-    ;;      See https://github.com/acristoffers/tree-sitter-matlab/issues/47
-    ;;
-    ;; TODO indent
-    ;;      filesToCheck = ...
-    ;;          [
-    ;;            ^                <== RET on previous line or TAB should be 
here
-    ;;      See https://github.com/acristoffers/tree-sitter-matlab/issues/47
-    ;;
-    ;; TODO indent
     ;;      classdef foo
     ;;          ^                  <== RET on previous line should go here (or 
TAB to here)
     ;;
diff --git a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun2.m 
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun2.m
new file mode 100644
index 0000000000..64488272a4
--- /dev/null
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun2.m
@@ -0,0 +1,11 @@
+% -*- matlab-ts -*-
+
+% See: See https://github.com/acristoffers/tree-sitter-matlab/issues/47
+%
+% We want a RET "C-m" on the "outResult = longFunction(..." line to indent.
+% Likewise for a TAB "C-i" on the line.
+%
+% (t-utils-xr "C-n" "C-n" "C-e" "C-m" (insert "b);") (re-search-backward 
"^fun") (print (buffer-substring-no-properties (point) (point-max))))
+function outResult = indent_xr_fun2(b)
+          outResult = longFunction(...
+end
diff --git 
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun2_expected.org 
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun2_expected.org
new file mode 100644
index 0000000000..0e4a94bf3b
--- /dev/null
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun2_expected.org
@@ -0,0 +1,80 @@
+#+startup: showall
+
+* Executing commands from indent_xr_fun2.m:8:2:
+
+  (t-utils-xr "C-n" "C-n" "C-e" "C-m" (insert "b);") (re-search-backward 
"^fun") (print (buffer-substring-no-properties (point) (point-max))))
+
+- Invoking      : "C-n" = next-line
+  Start point   :  356
+  Moved to point:  395
+  : 9:38: function outResult = indent_xr_fun2(b)
+  :                                             ^
+  No buffer modifications
+
+- Invoking      : "C-n" = next-line
+  Start point   :  395
+  Moved to point:  434
+  : 10:38:           outResult = longFunction(...
+  :                                              ^
+  No buffer modifications
+
+- Invoking      : "C-e" = move-end-of-line
+  Start point   :  434
+  No point movement
+  No buffer modifications
+
+- Invoking      : "C-m" = newline
+  Start point   :  434
+  Moved to point:  437
+  : 11:8:         
+  :               ^
+  Buffer modified:
+  #+begin_src diff
+--- start_contents
++++ end_contents
+@@ -7,5 +7,6 @@
+ %
+ % (t-utils-xr "C-n" "C-n" "C-e" "C-m" (insert "b);") (re-search-backward 
"^fun") (print (buffer-substring-no-properties (point) (point-max))))
+ function outResult = indent_xr_fun2(b)
+-          outResult = longFunction(...
++    outResult = longFunction(...
++        
+ end
+  #+end_src diff
+
+- Invoking      : (insert "b);")
+  Start point   :  437
+  Moved to point:  440
+  : 11:11:         b);
+  :                   ^
+  Buffer modified:
+  #+begin_src diff
+--- start_contents
++++ end_contents
+@@ -8,5 +8,5 @@
+ % (t-utils-xr "C-n" "C-n" "C-e" "C-m" (insert "b);") (re-search-backward 
"^fun") (print (buffer-substring-no-properties (point) (point-max))))
+ function outResult = indent_xr_fun2(b)
+     outResult = longFunction(...
+-        
++        b);
+ end
+  #+end_src diff
+
+- Invoking      : (re-search-backward "^fun")
+  Start point   :  440
+  Moved to point:  357
+  : 9:0: function outResult = indent_xr_fun2(b)
+  :      ^
+  No buffer modifications
+
+- Invoking      : (print (buffer-substring-no-properties (point) (point-max)))
+  Start point   :  357
+  No point movement
+  standard-output:
+  #+begin_example
+function outResult = indent_xr_fun2(b)
+    outResult = longFunction(...
+        b);
+end
+  #+end_example
+  No buffer modifications

Reply via email to