[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 93da584 449/468: Bump indentation tests, add miss
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 93da584 449/468: Bump indentation tests, add missing function-call-arguments suite |
Date: |
Thu, 5 Aug 2021 04:59:27 -0400 (EDT) |
branch: elpa/lua-mode
commit 93da584109ea2bfb4627436a521cc1f0642ac9b5
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
Bump indentation tests, add missing function-call-arguments suite
---
test/indentation-tests/assignment-indentation.lua | 8 +-
test/indentation-tests/function-call-arguments.lua | 109 +++++++++++++++
test/test-indentation.el | 148 +++++++++++----------
3 files changed, 189 insertions(+), 76 deletions(-)
diff --git a/test/indentation-tests/assignment-indentation.lua
b/test/indentation-tests/assignment-indentation.lua
index 10adb60..4d0f7ee 100644
--- a/test/indentation-tests/assignment-indentation.lua
+++ b/test/indentation-tests/assignment-indentation.lua
@@ -175,14 +175,14 @@ x = t[very_very_very_long_name()
-- does not indent binary operators inside brackets: indentation 1
-x = [
+x = foo[
very_very_very_long_name() +
another_very_very_very_long_name()
- ]
+ ]
-- does not indent binary operators inside brackets: indentation 2
-x = [
+x = foo[
very_very_very_long_name()
+ another_very_very_very_long_name()
- ]
+ ]
diff --git a/test/indentation-tests/function-call-arguments.lua
b/test/indentation-tests/function-call-arguments.lua
new file mode 100644
index 0000000..e4a520a
--- /dev/null
+++ b/test/indentation-tests/function-call-arguments.lua
@@ -0,0 +1,109 @@
+-- THINGS TO TEST:
+-- parentheses vs braces (table ctor)
+-- close paren/brace: attached/detached
+-- alignment/indentation
+-- args in horizontal line vs args in column vs mixed
+-- one of params is a table/function literal/function call/single-line
table/single-line function
+
+-- it works for single line case
+
+foobar(a, b, c)
+
+a = 0
+
+-- it works for indenting all args on one line: close paren on separate line
+
+foobar(
+ a, b, c
+)
+
+a = 0
+
+-- it works for indenting all args in a column: close paren on separate line
+
+foobar(
+ a,
+ b,
+ c
+)
+
+a = 0
+
+-- it works for mixed arg indentation: close paren on separate line
+
+foobar(
+ a, b,
+ c, d
+)
+
+a = 0
+
+-- it works with table ctorfor single line case
+
+foobar{a, b, c}
+
+a = 0
+
+-- it works with table ctor for indenting all args on one line: close paren on
separate line
+
+foobar{
+ a, b, c
+}
+
+a = 0
+
+-- it works with table ctor for indenting all args in a column: close paren on
separate line
+
+foobar{
+ a,
+ b,
+ c
+}
+
+a = 0
+
+-- it works with table ctor for mixed arg indentation: close paren on separate
line
+
+foobar{
+ a, b,
+ c, d
+}
+
+a = 0
+
+-- it works for mixed arg indentation with table in the middle: close paren on
separate line
+
+foobar(
+ a, b,
+ {
+ foo = bar,
+ qux = quux
+ }, d
+)
+
+a = 0
+
+-- it works for mixed arg indentation with table first: close paren on
separate line
+
+foobar(
+ {
+ foo = bar,
+ qux = quux
+ }, b,
+ c, d
+)
+
+a = 0
+
+-- it works for mixed arg indentation with table last: close paren on separate
line
+
+foobar(
+ a, b,
+ c, {
+ foo = bar,
+ qux = quux
+ }
+)
+
+a = 0
+
diff --git a/test/test-indentation.el b/test/test-indentation.el
index 7cc6d12..d581504 100644
--- a/test/test-indentation.el
+++ b/test/test-indentation.el
@@ -59,163 +59,167 @@
indentation-tests))
(describe "Continuation lines"
- (it "are indented before/after binary operators"
- (let ((binops '("+" "-" "*" "/" "^" "%" ".."
- "<" "<=" ">" ">=" "==" "~="
- "and" "or")))
- (cl-dolist (binop binops)
- (lua--reindent-like (replace-regexp-in-string "BINOP" binop "\
+ (lua--parametrize-tests
+ (binop)
+ (("+") ("-") ("*") ("/") ("^") ("%") ("..")
+ ("<") ("<=") (">") (">=") ("==") ("~=") ("and") ("or"))
+
+ :it (format "are indented before/after binary operators: %s" binop)
+ (expect (replace-regexp-in-string "BINOP" binop "\
a = foo BINOP
- bar" 'fixedcase))
- (lua--reindent-like (replace-regexp-in-string "BINOP" binop "\
+ bar" 'fixedcase)
+ :to-be-reindented-the-same-way)
+ (expect (replace-regexp-in-string "BINOP" binop "\
a = foo
- BINOP bar" 'fixedcase)))))
-
-
-
- (xit "are indented before/after unary operators"
- (expect (lua--reindent-like "\
-foo = bar
- -#some_str"))
-
- (cl-dolist (unop '("-" "#" "not "))
- (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
-foobar(qux,
- <>quux)")))
- (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
-foobar(qux, xyzzy
- <>quux)")))
- (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
-foobar(
- <>quux)")))
- (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
-x = {qux,
- <>quux}")))
- (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
-x = {qux;
- <>quux}")))
- (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
-x = {qux, xyzzy
- <>quux}")))
- (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
-x = {
- <>quux
-}"))))))
+ BINOP bar" 'fixedcase)
+ :to-be-reindented-the-same-way))
+) ;; (
+
+
+
+;; (xit "are indented before/after unary operators"
+;; (expect (lua--reindent-like "\
+;; foo = bar
+;; -#some_str"))
+
+;; (cl-dolist (unop '("-" "#" "not "))
+;; (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
+;; foobar(qux,
+;; <>quux)")))
+;; (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
+;; foobar(qux, xyzzy
+;; <>quux)")))
+;; (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
+;; foobar(
+;; <>quux)")))
+;; (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
+;; x = {qux,
+;; <>quux}")))
+;; (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
+;; x = {qux;
+;; <>quux}")))
+;; (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
+;; x = {qux, xyzzy
+;; <>quux}")))
+;; (expect (lua--reindent-like (replace-regexp-in-string "<>" unop "\
+;; x = {
+;; <>quux
+;; }"))))))
(describe "Function indentation"
(it "indents function call arguments"
- (expect (lua--reindent-like "\
+ (expect "\
foobar(
- a, b, c)"))
- (expect (lua--reindent-like "\
+ a, b, c)" :to-be-reindented-the-same-way)
+ (expect "\
foobar(
a,
- b, c)"))
+ b, c)" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar(
a, b, c
-)"))
+)" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar(a,
b,
- c)"))
+ c)" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar{
a, b, c
-}")))
+}" :to-be-reindented-the-same-way))
(it "indent blocks with lua-indent-nested-block-content-align"
(let ((lua-indent-nested-block-content-align nil))
- (expect (lua--reindent-like "\
+ (expect "\
call_some_fn( something, {
val = 5,
another = 6,
-} )"))
- (expect (lua--reindent-like "\
+} )" :to-be-reindented-the-same-way)
+ (expect "\
local def = {
some_very_long_name = { fn =
function()
return true
end
}
-}"))
+}" :to-be-reindented-the-same-way)
))
(it "indent blocks with lua-indent-close-paren-align"
(let ((lua-indent-close-paren-align nil))
- (expect (lua--reindent-like "\
+ (expect "\
local foo = setmetatable( {
a = 4,
b = 5,
}, {
__index = some_func,
-} )"))
+} )" :to-be-reindented-the-same-way)
))
(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 "\
+ (expect "\
foobar({
a, b, c
-})"))
+})" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar(a, {
b,
c
-})"))
+})" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar(
a,
{
b,
c
-})"))
+})" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar(
a,
{
b,
c
}
-)"))
+)" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar(a,
{
b,
c
-})"))
+})" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar(a,
{
b,
c
}
-)"))
+)" :to-be-reindented-the-same-way)
- (expect (lua--reindent-like "\
+ (expect "\
foobar(
{
a,
b
},
c, d
-)"))
+)" :to-be-reindented-the-same-way)
)))
(ert-deftest lua-indentation-keywords-with-special-characters ()
- (expect (lua--reindent-like "\
+ (expect "\
do
foobar = _do
-end")))
+end" :to-be-reindented-the-same-way))
- [nongnu] elpa/lua-mode 7a97e1b 341/468: correct spelling mistake, (continued)
- [nongnu] elpa/lua-mode 7a97e1b 341/468: correct spelling mistake, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0715340 337/468: Merge pull request #131 from jorams/fill-paragraph-save-excursion, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d759699 335/468: Merge pull request #129 from immerrr/fix-global-variable-in-lua-interpreter, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 459e3b7 427/468: Fix FIXME: `lua-prefix-key' is always `boundp', Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b793852 434/468: Add regression test, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6a30c39 447/468: lua-is-continuing-statement-p: short-circuit to false for "breaker" kws, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b043ca4 451/468: lua-is-continuing-statement-p-1: fix missing save-excursion on branch, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6a837f7 458/468: with-lua-buffer: ensure font-lock is activated, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 08d83fc 443/468: Merge pull request #180 from nbfalcon/bugfix/lua-start-process-hangs, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 56af490 446/468: lua-find-regexp: escape string/comment after a match is ignored, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 93da584 449/468: Bump indentation tests, add missing function-call-arguments suite,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 0018e95 452/468: make-indentation-pair: don't calculate full indentation on every closer, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d2ff304 456/468: Copy cl-signum into lua--signum for backward compat, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3688bf7 347/468: Merge pull request #136 from EdwardBetts/spelling, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6c69183 351/468: Merge pull request #139 from rrthomas/master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode eacf137 349/468: Spell “Lua” consistently and its “process” (not “subprocess”), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode acd0c55 354/468: Revert to using group-n in lua--left-shifter-regexp, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3ba5ecc 360/468: Minor simplification of lua-get-create-process, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c6e053e 361/468: Spell “Lua” consistently and its “process” (not “subprocess”), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 7909513 363/468: Merge pull request #141 from rrthomas/master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a260cf9 368/468: Travis: enable testing on 26.1, 26.2 and git snapshot, Philip Kaludercic, 2021/08/05