[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode bbd8f91 096/496: Add tests for all implemented
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode bbd8f91 096/496: Add tests for all implemented smie grammars |
Date: |
Sun, 29 Aug 2021 11:33:15 -0400 (EDT) |
branch: elpa/swift-mode
commit bbd8f9117f5f8df887aa1755939aa0ef621aba9b
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>
Add tests for all implemented smie grammars
---
test/indentation-tests.el | 325 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 325 insertions(+)
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index 4f07885..502e961 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -159,6 +159,32 @@ if true {
}
")
+(check-indentation indent-if-else
+ "
+if true {
+} else {
+|foo
+}
+" "
+if true {
+} else {
+ |foo
+}
+")
+
+(check-indentation indent-if-else-if
+ "
+if true {
+} else if false {
+|foo
+}
+" "
+if true {
+} else if false {
+ |foo
+}
+")
+
(check-indentation indent-if-body--no-effect-if-already-indented
"
if true {
@@ -170,6 +196,21 @@ if true {
}
")
+(check-indentation indent-if-body-nested
+ "
+if foo {
+ if true {
+|foo
+ }
+}
+" "
+if foo {
+ if true {
+ |foo
+ }
+}
+")
+
(check-indentation indents-case-statements-to-same-level-as-enclosing-switch/1
"
switch true {
@@ -338,6 +379,74 @@ case y:
}
")
+(check-indentation indents-case-statements-with-destucturing/1
+ "
+switch true {
+case let(x, y):
+|foo
+}
+" "
+switch true {
+case let(x, y):
+ |foo
+}
+")
+
+(check-indentation indents-case-statements-with-destucturing/2
+ "
+switch true {
+case let .Foo(x):
+|foo
+}
+" "
+switch true {
+case let .Foo(x):
+ |foo
+}
+")
+
+(check-indentation indents-case-statements-with-guard
+ "
+switch true {
+case foo where bar:
+|foo
+}
+" "
+switch true {
+case foo where bar:
+ |foo
+}
+")
+
+(check-indentation indents-case-statements-with-multiline-guard/1
+ "
+switch true {
+case foo where bar,
+|bar where baz:
+}
+" "
+switch true {
+case foo where bar,
+ |bar where baz:
+}
+")
+
+(check-indentation indents-case-statements-with-multiline-guard/2
+ "
+switch true {
+case foo where bar,
+ bar where baz:
+|foo
+}
+" "
+switch true {
+case foo where bar,
+ bar where baz:
+ |foo
+}
+")
+
+
(check-indentation indents-case-statements-to-user-defined-offset/1
"
switch true {
@@ -385,6 +494,222 @@ enum T {
}
")
+(check-indentation indents-case-statements-in-enum/3
+ "
+enum Foo: Bar {
+ |case
+}
+" "
+enum Foo: Bar {
+ |case
+}
+")
+
+(check-indentation indents-for-statements/1
+ "
+for index in 1..5 {
+|foo
+}
+" "
+for index in 1..5 {
+ |foo
+}
+")
+
+(check-indentation indents-for-statements/2
+ "
+for (key, value) in dict {
+|foo
+}
+" "
+for (key, value) in dict {
+ |foo
+}
+")
+
+(check-indentation indents-for-statements/3
+ "
+for var index = 0; index < 3; ++index {
+|foo
+}
+" "
+for var index = 0; index < 3; ++index {
+ |foo
+}
+")
+
+(check-indentation indents-while-statements
+ "
+while foo < bar{
+|foo
+}
+" "
+while foo < bar{
+ |foo
+}
+")
+
+(check-indentation indents-import-statements/1
+ "
+import Foo
+ |import Bar
+" "
+import Foo
+|import Bar
+")
+
+(check-indentation indents-class-declaration/1
+ "
+class Foo {
+ |foo
+}
+" "
+class Foo {
+ |foo
+}
+")
+
+(check-indentation indents-class-declaration/2
+ "
+class Foo: Bar {
+ |foo
+}
+" "
+class Foo: Bar {
+ |foo
+}
+")
+
+(check-indentation indents-class-declaration/3
+ "
+class Foo: Foo, Bar, Baz {
+ |foo
+}
+" "
+class Foo: Foo, Bar, Baz {
+ |foo
+}
+")
+
+(check-indentation indents-class-declaration/4
+ "
+class Foo: Bar {
+|class Baz: Bar {
+ }
+}
+" "
+class Foo: Bar {
+ |class Baz: Bar {
+ }
+}
+")
+
+(check-indentation indents-func-declaration/1
+ "
+func Foo(a: String) {
+|foo
+}
+" "
+func Foo(a: String) {
+ |foo
+}
+")
+
+(check-indentation indents-func-declaration/2
+ "
+override func Foo() {
+|foo
+}
+" "
+override func Foo() {
+ |foo
+}
+")
+
+(check-indentation indents-func-declaration/3
+ "
+func Foo(b: Double...) -> Bool {
+|foo
+}
+" "
+func Foo(b: Double...) -> Bool {
+ |foo
+}
+")
+
+(check-indentation indents-func-declaration/4
+ "
+class Foo {
+ override func Foo(b: Double...) -> Bool {
+|foo
+ }
+}
+" "
+class Foo {
+ override func Foo(b: Double...) -> Bool {
+ |foo
+ }
+}
+")
+
+(check-indentation indents-declaration/1
+ "
+var foo = bar + baz
+ |
+" "
+var foo = bar + baz
+|
+")
+
+(check-indentation indents-declaration/2
+ "
+let foo = bar +
+|baz
+" "
+let foo = bar +
+ |baz
+")
+
+(check-indentation indents-declaration/3
+ "
+let foo = [foo: bar, bar: baz]
+ |
+" "
+let foo = [foo: bar, bar: baz]
+|
+")
+
+(check-indentation indents-declaration/4
+ "
+let foo = [
+|bar: baz
+ ]
+" "
+let foo = [
+ |bar: baz
+ ]
+")
+
+(check-indentation indents-declaration/5
+ "
+let foo = [foo, bar]
+ |
+" "
+let foo = [foo, bar]
+|
+")
+
+(check-indentation indents-declaration/6
+ "
+let foo = [
+|bar
+ ]
+" "
+let foo = [
+ |bar
+ ]
+")
+
(provide 'indentation-tests)
;;; indentation-tests.el ends here
- [nongnu] elpa/swift-mode 8d2720b 020/496: Add autoload token, (continued)
- [nongnu] elpa/swift-mode 8d2720b 020/496: Add autoload token, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 71e3d6f 033/496: Remove unneeded infrastructure, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 28c5b54 027/496: More improvements to comment handling, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9b367fe 038/496: Remove duplicate in keywords list, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0bf214b 030/496: Update readme, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode cb745d5 029/496: Define basic indentation command., ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0344f63 036/496: Merge pull request #11 from bbatsov/patch-1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 89ce39c 050/496: Format file sections, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0f99a5a 067/496: Tweak docstring to supress checkdoc error, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 821d9af 064/496: Make switch-case indent offset customisable, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode bbd8f91 096/496: Add tests for all implemented smie grammars,
ELPA Syncer <=
- [nongnu] elpa/swift-mode cfbc318 092/496: Merge pull request #24 from ap4y/fix_paragraph_movements, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a8fa421 086/496: Use a more descriptive map variable name inside its definition, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0c908ad 103/496: Remove an outdated statement about the indentation code, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 41d38bd 117/496: Clarify syntax table for syntactic fontification., ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 18e1e4a 107/496: Highlight attributes as keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 98556c1 120/496: Start work on version 0.3, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 8be19fb 108/496: Highlight self and super as keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 3caacf3 007/496: Highlight attributes and _ wildcards, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c8f1dbd 014/496: Update readme, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode adb3c13 039/496: Restore Emacs 24.1 requirement, ELPA Syncer, 2021/08/29