[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 44fcd37a486 08/11: Add more c-ts-mode indent tests
From: |
Yuan Fu |
Subject: |
master 44fcd37a486 08/11: Add more c-ts-mode indent tests |
Date: |
Sun, 1 Dec 2024 21:10:23 -0500 (EST) |
branch: master
commit 44fcd37a486399be048fb03b9456497af78632fe
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Add more c-ts-mode indent tests
* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: Fix
label test.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add some
test, make other tests harder.
---
.../progmodes/c-ts-mode-resources/indent-bsd.erts | 12 ++--
.../lisp/progmodes/c-ts-mode-resources/indent.erts | 70 +++++++++++++++++++---
2 files changed, 68 insertions(+), 14 deletions(-)
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
index fa65ba83a69..0f6f87800ec 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
@@ -37,19 +37,19 @@ Name: Labels
int
main (void)
{
- label:
- return 0;
+label:
+ return 0;
if (true)
{
- label:
- return 0;
+ label:
+ return 0;
}
else
{
if (true)
{
- label:
- return 0;
+ label:
+ return 0;
}
}
}
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 61e61677ed7..691f5b6ecfd 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -54,14 +54,27 @@ main (void)
}
=-=-=
+Name: Enum
+=-=
+enum
+week
+{
+ Mon, Tue, Wed,
+ Thur, Fri, Sat, Sun
+};
+=-=-=
+
+
Name: For Loop with Multi-line Condition (GNU Style)
=-=
int main()
{
- for (int i = 0;
+ for (
+ int i = 0;
i < b;
- i++)
+ i++
+ )
{
return 0;
}
@@ -127,6 +140,15 @@ int main() {
}
=-=-=
+Name: Type and function name on separate line
+=-=
+struct
+aaa *
+fn()
+{
+};
+=-=-=
+
Name: Multiline Parameter List (bug#60398)
=-=
@@ -223,7 +245,7 @@ make_pair(int long_identifier_a[], int long_identifier_b[],
=-=-=
-Name: Compound Statement after code
+Name: Compound Statement after code (Bug#74507)
=-=
#define IOTA(var, n) for (int var = 0; var != (n); ++var)
@@ -233,11 +255,20 @@ IOTA (v, 10) {
printf("%d ", v);
}
-const char *msg = "Hello, world!"; {
-puts("Hello, world!");
+for (int i = 0;
+i < 10;
+i++) {
+IOTA (v, 10) {
+printf("%d ", v);
}
}
+{
+IOTA (v, 10) {
+printf("%d ", v);
+}
+}
+}
=-=
#define IOTA(var, n) for (int var = 0; var != (n); ++var)
int main()
@@ -246,11 +277,20 @@ int main()
printf("%d ", v);
}
- const char *msg = "Hello, world!"; {
- puts("Hello, world!");
+ for (int i = 0;
+ i < 10;
+ i++) {
+ IOTA (v, 10) {
+ printf("%d ", v);
+ }
}
-}
+ {
+ IOTA (v, 10) {
+ printf("%d ", v);
+ }
+ }
+}
=-=-=
Name: Switch-Case statement
@@ -503,6 +543,16 @@ namespace test {
}
=-=-=
+Name: Access specifier
+=-=
+class MyClass {
+public: // Public access specifier
+ int x; // Public attribute
+private: // Private access specifier
+ int y; // Private attribute
+};
+=-=-=
+
Name: Namespace and template (bug#72263)
=-=
@@ -510,11 +560,13 @@ namespace A {
T myfunction1(const char *fname)
{
+return a;
}
template <class T>
T myfunction2(const char *fname)
{
+return a;
}
}
=-=
@@ -522,11 +574,13 @@ namespace A {
T myfunction1(const char *fname)
{
+ return a;
}
template <class T>
T myfunction2(const char *fname)
{
+ return a;
}
}
=-=-=
- master updated (4afd1eca366 -> de98b5a24f2), Yuan Fu, 2024/12/01
- master c65c5d02224 01/11: Improve c-ts-mode compound indents (bug#74507), Yuan Fu, 2024/12/01
- master d0b918d8f3c 04/11: Add treesit-explore command, Yuan Fu, 2024/12/01
- master 4afdb7e80fe 05/11: ; Minor simplification for tree-sitter indent preset column-0, Yuan Fu, 2024/12/01
- master 63d69bd1549 07/11: Use new baseline indent rule in c-ts-mode, Yuan Fu, 2024/12/01
- master 9acf6eff01a 10/11: Standardize and promote c-ts-mode's custom matcher and anchor, Yuan Fu, 2024/12/01
- master de98b5a24f2 11/11: ; Indent by 8 in BSD indent tests for c-ts-mode, Yuan Fu, 2024/12/01
- master 1e44c63fcad 03/11: Allow treesit-simple-indent's rule to be a single function, Yuan Fu, 2024/12/01
- master 1d425125694 02/11: Refactor treesit--indent-1, Yuan Fu, 2024/12/01
- master e37cd4fa597 06/11: Add baseline tree-sitter indent rule for C-like languages, Yuan Fu, 2024/12/01
- master 44fcd37a486 08/11: Add more c-ts-mode indent tests,
Yuan Fu <=
- master 994258f5567 09/11: Remove unused functions in c-ts-mode, Yuan Fu, 2024/12/01