aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuan Fu2024-11-30 23:49:14 -0800
committerYuan Fu2024-12-01 17:53:23 -0800
commit44fcd37a486399be048fb03b9456497af78632fe (patch)
tree30051ac0b6755d390b04c60767d3c0e69cb04911
parent63d69bd154987bcc0434e0f85e09bf5dfa07b827 (diff)
downloademacs-44fcd37a486399be048fb03b9456497af78632fe.tar.gz
emacs-44fcd37a486399be048fb03b9456497af78632fe.zip
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.
-rw-r--r--test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts12
-rw-r--r--test/lisp/progmodes/c-ts-mode-resources/indent.erts70
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
37int 37int
38main (void) 38main (void)
39{ 39{
40 label: 40label:
41 return 0; 41 return 0;
42 if (true) 42 if (true)
43 { 43 {
44 label: 44 label:
45 return 0; 45 return 0;
46 } 46 }
47 else 47 else
48 { 48 {
49 if (true) 49 if (true)
50 { 50 {
51 label: 51 label:
52 return 0; 52 return 0;
53 } 53 }
54 } 54 }
55} 55}
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)
54} 54}
55=-=-= 55=-=-=
56 56
57Name: Enum
58=-=
59enum
60week
61{
62 Mon, Tue, Wed,
63 Thur, Fri, Sat, Sun
64};
65=-=-=
66
67
57Name: For Loop with Multi-line Condition (GNU Style) 68Name: For Loop with Multi-line Condition (GNU Style)
58 69
59=-= 70=-=
60int main() 71int main()
61{ 72{
62 for (int i = 0; 73 for (
74 int i = 0;
63 i < b; 75 i < b;
64 i++) 76 i++
77 )
65 { 78 {
66 return 0; 79 return 0;
67 } 80 }
@@ -127,6 +140,15 @@ int main() {
127} 140}
128=-=-= 141=-=-=
129 142
143Name: Type and function name on separate line
144=-=
145struct
146aaa *
147fn()
148{
149};
150=-=-=
151
130Name: Multiline Parameter List (bug#60398) 152Name: Multiline Parameter List (bug#60398)
131 153
132=-= 154=-=
@@ -223,7 +245,7 @@ make_pair(int long_identifier_a[], int long_identifier_b[],
223 245
224=-=-= 246=-=-=
225 247
226Name: Compound Statement after code 248Name: Compound Statement after code (Bug#74507)
227 249
228=-= 250=-=
229#define IOTA(var, n) for (int var = 0; var != (n); ++var) 251#define IOTA(var, n) for (int var = 0; var != (n); ++var)
@@ -233,11 +255,20 @@ IOTA (v, 10) {
233printf("%d ", v); 255printf("%d ", v);
234} 256}
235 257
236const char *msg = "Hello, world!"; { 258for (int i = 0;
237puts("Hello, world!"); 259i < 10;
260i++) {
261IOTA (v, 10) {
262printf("%d ", v);
238} 263}
239} 264}
240 265
266{
267IOTA (v, 10) {
268printf("%d ", v);
269}
270}
271}
241=-= 272=-=
242#define IOTA(var, n) for (int var = 0; var != (n); ++var) 273#define IOTA(var, n) for (int var = 0; var != (n); ++var)
243int main() 274int main()
@@ -246,11 +277,20 @@ int main()
246 printf("%d ", v); 277 printf("%d ", v);
247 } 278 }
248 279
249 const char *msg = "Hello, world!"; { 280 for (int i = 0;
250 puts("Hello, world!"); 281 i < 10;
282 i++) {
283 IOTA (v, 10) {
284 printf("%d ", v);
285 }
251 } 286 }
252}
253 287
288 {
289 IOTA (v, 10) {
290 printf("%d ", v);
291 }
292 }
293}
254=-=-= 294=-=-=
255 295
256Name: Switch-Case statement 296Name: Switch-Case statement
@@ -503,6 +543,16 @@ namespace test {
503} 543}
504=-=-= 544=-=-=
505 545
546Name: Access specifier
547=-=
548class MyClass {
549public: // Public access specifier
550 int x; // Public attribute
551private: // Private access specifier
552 int y; // Private attribute
553};
554=-=-=
555
506Name: Namespace and template (bug#72263) 556Name: Namespace and template (bug#72263)
507 557
508=-= 558=-=
@@ -510,11 +560,13 @@ namespace A {
510 560
511T myfunction1(const char *fname) 561T myfunction1(const char *fname)
512{ 562{
563return a;
513} 564}
514 565
515template <class T> 566template <class T>
516T myfunction2(const char *fname) 567T myfunction2(const char *fname)
517{ 568{
569return a;
518} 570}
519} 571}
520=-= 572=-=
@@ -522,11 +574,13 @@ namespace A {
522 574
523 T myfunction1(const char *fname) 575 T myfunction1(const char *fname)
524 { 576 {
577 return a;
525 } 578 }
526 579
527 template <class T> 580 template <class T>
528 T myfunction2(const char *fname) 581 T myfunction2(const char *fname)
529 { 582 {
583 return a;
530 } 584 }
531} 585}
532=-=-= 586=-=-=