From 6c443aa80b71a63a20758f59a9d9718412e52782 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sat, 30 Nov 2024 23:49:14 -0800 Subject: [PATCH] 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. (cherry picked from commit 44fcd37a486399be048fb03b9456497af78632fe) --- .../c-ts-mode-resources/indent-bsd.erts | 12 +-- .../progmodes/c-ts-mode-resources/indent.erts | 88 ++++++++++++++++++- 2 files changed, 92 insertions(+), 8 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 2f3540c3970..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,6 +245,54 @@ make_pair(int long_identifier_a[], int long_identifier_b[], =-=-= +Name: Compound Statement after code (Bug#74507) + +=-= +#define IOTA(var, n) for (int var = 0; var != (n); ++var) +int main() +{ +IOTA (v, 10) { +printf("%d ", v); +} + +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() +{ + IOTA (v, 10) { + printf("%d ", v); + } + + for (int i = 0; + i < 10; + i++) { + IOTA (v, 10) { + printf("%d ", v); + } + } + + { + IOTA (v, 10) { + printf("%d ", v); + } + } +} +=-=-= + Name: Switch-Case statement =-= @@ -473,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) =-= @@ -480,11 +560,13 @@ namespace A { T myfunction1(const char *fname) { +return a; } template T myfunction2(const char *fname) { +return a; } } =-= @@ -492,11 +574,13 @@ namespace A { T myfunction1(const char *fname) { + return a; } template T myfunction2(const char *fname) { + return a; } } =-=-= -- 2.39.5