emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/lua-mode 505896f 386/468: added tests for lua-indent-neste


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 505896f 386/468: added tests for lua-indent-nested-block-content-align and lua-indent-close-paren-align
Date: Thu, 5 Aug 2021 04:59:14 -0400 (EDT)

branch: elpa/lua-mode
commit 505896fbb771332d99b44c2f3f4e3f406a665a16
Author: edam <tim@ed.am>
Commit: edam <tim@ed.am>

    added tests for lua-indent-nested-block-content-align and 
lua-indent-close-paren-align
---
 test/test-indentation.el | 83 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)

diff --git a/test/test-indentation.el b/test/test-indentation.el
index 44d2355..6c7c59d 100644
--- a/test/test-indentation.el
+++ b/test/test-indentation.el
@@ -501,10 +501,91 @@ foobar(
       b
    },
    c, d
-)"))))
+)")))
+
+  (it "indent blocks with lua-indent-nested-block-content-align"
+       (let ((lua-indent-nested-block-content-align nil))
+         (expect (lua--reindent-like "\
+call_some_fn( something, {
+      val = 5,
+      another = 6,
+} )"))
+         (expect (lua--reindent-like "\
+local def = {
+   some_very_long_name = { fn =
+         function()
+            return true
+         end
+   }
+}"))
+         ))
+
+  (it "indent blocks with lua-indent-close-paren-align"
+       (let ((lua-indent-close-paren-align nil))
+         (expect (lua--reindent-like "\
+local foo = setmetatable( {
+      a = 4,
+      b = 5,
+}, {
+      __index = some_func,
+} )"))
+         ))
+
+  (it "indents nested tables with alternative block indenting"
+       (let ((lua-indent-nested-block-content-align nil)
+                 (lua-indent-close-paren-align nil))
+         (expect (lua--reindent-like "\
+foobar({
+      a, b, c
+})"))
+
+         (expect (lua--reindent-like "\
+foobar(a, {
+      b,
+      c
+})"))
+
+         (expect (lua--reindent-like "\
+foobar(
+   a,
+   {
+      b,
+      c
+})"))
+
+         (expect (lua--reindent-like "\
+foobar(
+   a,
+   {
+      b,
+      c
+   }
+)"))
 
+         (expect (lua--reindent-like "\
+foobar(a,
+   {
+      b,
+      c
+})"))
 
+         (expect (lua--reindent-like "\
+foobar(a,
+   {
+      b,
+      c
+   }
+)"))
 
+         (expect (lua--reindent-like "\
+foobar(
+   {
+      a,
+      b
+   },
+   c, d
+)"))
+         )))
 
 (ert-deftest lua-indentation-defun ()
   ;;    [local] function funcname funcbody



reply via email to

[Prev in Thread] Current Thread [Next in Thread]