[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 1365ba0 412/468: Enable XFAIL-ing tests for conti
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 1365ba0 412/468: Enable XFAIL-ing tests for continuation in block intros |
Date: |
Thu, 5 Aug 2021 04:59:19 -0400 (EDT) |
branch: elpa/lua-mode
commit 1365ba0df92d33adafb8a3ce8fb1784087380826
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
Enable XFAIL-ing tests for continuation in block intros
---
lua-mode.el | 25 ++++++++++++--------
test/indentation-tests/continuation-lines.lua | 19 +--------------
test/indentation-tests/for-equals-block.lua | 26 +++++++++++++++------
test/indentation-tests/for-in-block.lua | 33 ++++++++++++++++++++-------
4 files changed, 60 insertions(+), 43 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index ef86c98..0f45136 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1354,16 +1354,21 @@ The criteria for a continuing statement are:
(let (prev-line return-value)
(save-excursion (setq prev-line (lua-forward-line-skip-blanks 'back)))
(and prev-line
- ;; Binary operator or keyword that implies continuation.
- (and (setq return-value
- (or (lua-first-token-continues-p)
- (save-excursion (and (goto-char prev-line)
- ;; check last token of previous
nonblank line
- (lua-last-token-continues-p)))))
- (not (member (car-safe (lua--backward-up-list-noerror))
- ;; XXX: can we also add "{" here?
- '("(" "[")))
- return-value))))
+ (or
+ ;; Binary operator or keyword that implies continuation.
+ (and (setq return-value
+ (or (lua-first-token-continues-p)
+ (save-excursion (and (goto-char prev-line)
+ ;; check last token of previous
nonblank line
+ (lua-last-token-continues-p)))))
+ (not (member (car-safe (lua--backward-up-list-noerror))
+ ;; XXX: can we also add "{" here?
+ '("(" "[")))
+ return-value)
+ ;; "for" expressions (until the next do) imply continuation.
+ (when (string-equal (car-safe (lua--backward-up-list-noerror)) "for")
+ (point))))))
+
(defun lua-is-continuing-statement-p (&optional parse-start)
diff --git a/test/indentation-tests/continuation-lines.lua
b/test/indentation-tests/continuation-lines.lua
index 63ac9fb..018c27b 100644
--- a/test/indentation-tests/continuation-lines.lua
+++ b/test/indentation-tests/continuation-lines.lua
@@ -134,7 +134,7 @@ x = [
+ another_very_very_very_long_name()
]
--- XFAIL: indentation in block-intros: while
+-- indentation in block-intros: while
while
foo do
@@ -153,23 +153,6 @@ end
a = 0
--- XFAIL: indentation in block-intros: for1
-
-for k, v
- in pairs(bar) do
- a = a + 1
-end
-
-a = 0
-
--- XFAIL: indentation in block-intros: for2
-
-for k, v
- in pairs(bar) do a = a + 1 end
-
-a = 0
-
-
-- indents expressions after return: basic
function myfunc()
diff --git a/test/indentation-tests/for-equals-block.lua
b/test/indentation-tests/for-equals-block.lua
index c3bc0b7..6609560 100644
--- a/test/indentation-tests/for-equals-block.lua
+++ b/test/indentation-tests/for-equals-block.lua
@@ -1,11 +1,11 @@
--- works for for ... = ... do block: 1
+-- works for "for ... = ... do" block: 1
for y = 0, 10 do
a = a + 1
end
a = 0
--- works for for ... = ... do block: 2
+-- works for "for ... = ... do" block: 2
for y = 0, 10
do
a = a + 1
@@ -13,7 +13,7 @@ end
a = 0
--- XFAIL: works for for ... = ... do block: 3
+-- works for "for ... = ... do" block: 3
for y = 0,
10 do
a = a + 1
@@ -21,7 +21,7 @@ end
a = 0
--- XFAIL: works for for ... = ... do block: 4
+-- works for "for ... = ... do" block: 4
for y = 0,
10
do
@@ -30,7 +30,7 @@ end
a = 0
--- works for for ... = ... do block: 5
+-- works for "for ... = ... do" block: 5
for y =
0, 10 do
a = a + 1
@@ -38,7 +38,7 @@ end
a = 0
--- works for for ... = ... do block: 6
+-- works for "for ... = ... do" block: 6
for y =
0, 10
do
@@ -47,7 +47,19 @@ end
a = 0
--- works for for ... = ... do block: single line
+-- works for "for ... = ... do" block: 7
+for y = foo(
+ 1,
+ 2),
+ bar(3,
+ 4)
+do
+ a = a + 1
+end
+
+a = 0
+
+-- works for "for ... = ... do" block: single line
for y = 0, 10 do a = a + 1 end
diff --git a/test/indentation-tests/for-in-block.lua
b/test/indentation-tests/for-in-block.lua
index 5d10dd0..c615dce 100644
--- a/test/indentation-tests/for-in-block.lua
+++ b/test/indentation-tests/for-in-block.lua
@@ -1,4 +1,4 @@
--- works for for ... do block: 1
+-- works for "for .. in .. do" block: 1
for k, v in pairs(bar) do
a = a + 1
@@ -6,7 +6,7 @@ end
a = 0
--- works for for ... do block: 2
+-- works for "for .. in .. do" block: 2
for
k, v in pairs(bar) do
@@ -15,7 +15,7 @@ end
a = 0
--- XFAIL: works for for ... do block: 3
+-- works for "for .. in .. do" block: 3
for
k,
@@ -25,7 +25,7 @@ end
a = 0
--- XFAIL: works for for ... do block: 4
+-- works for "for .. in .. do" block: 4
for
k,
@@ -36,7 +36,7 @@ end
a = 0
--- works for for ... do block: 5
+-- works for "for .. in .. do" block: 5
for k, v in
pairs(bar) do
@@ -45,7 +45,7 @@ end
a = 0
--- works for for ... do block: 6
+-- works for "for .. in .. do" block: 6
for k, v in
pairs(bar)
@@ -55,7 +55,24 @@ end
a = 0
--- works for for ... do block: 7
+-- works for "for .. in .. do" block: 7
+
+for k, v
+ in pairs(bar) do
+ a = a + 1
+end
+
+a = 0
+
+-- works for "for .. in .. do" block: 8
+
+for k, v
+ in pairs(bar) do a = a + 1 end
+
+a = 0
+
+
+-- works for "for .. in .. do" block: 9
for k, v in pairs(bar)
do
a = a + 1
@@ -63,7 +80,7 @@ end
a = 0
--- works for for ... do block: single line
+-- works for "for .. in .. do" block: single line
for k, v in pairs(bar) do a = a + 1 end
a = 0
- [nongnu] elpa/lua-mode 5a90655 355/468: correct spelling mistake, (continued)
- [nongnu] elpa/lua-mode 5a90655 355/468: correct spelling mistake, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode aca4014 356/468: utils: update to new buttercup matcher definition logic (#138), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e8281dc 362/468: Fix a minor bug in lua-kill-process, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1f04654 379/468: travis: enable testing on osx, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode eb93be5 380/468: Merge pull request #158 from immerrr/enable-testing-on-osx, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4cdee31 388/468: Use proper lexical-bindings instead of lexical-let*, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5dfc5be 399/468: Merge pull request #168 from immerrr/index-requires-as-imenu-items, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a3a71b1 400/468: Merge pull request #151 from edam/indent-nested-blocks, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 35b6e4c 402/468: Merge pull request #169 from tarsiiformes/typos, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 724bfa5 409/468: Fix support for file-local vars in indentation tests, add tests for blocks, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1365ba0 412/468: Enable XFAIL-ing tests for continuation in block intros,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 51a32ef 417/468: Merge pull request #176 from immerrr/improve-indentation-for-continuation-lines, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b37710e 418/468: Enable fontification of variable names in "for" and function parameters, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9c275cd 419/468: Add regression test for issue #157, fix lua-get-line-faces, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5fe5f57 422/468: Fix wait-for-prompt to take lua-prompt-regexp into account, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 83ec53d 430/468: `lua-funcname-at-point': be more strict, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 70b9384 448/468: Don't evaluate lua-is-continuing-statement-p-1 twice, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 350acce 450/468: Don't do lua-backward-up-list calculation for overrides if not necessary, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3e89784 454/468: Fix test suite names, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode af274e4 455/468: Merge pull request #184 from immerrr/fix-and-optimize-finding-matching-blocks, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d81c700 466/468: Bump version tag, Philip Kaludercic, 2021/08/05