diff options
| author | Yuan Fu | 2024-11-30 23:49:14 -0800 |
|---|---|---|
| committer | Yuan Fu | 2024-12-01 17:53:23 -0800 |
| commit | 44fcd37a486399be048fb03b9456497af78632fe (patch) | |
| tree | 30051ac0b6755d390b04c60767d3c0e69cb04911 | |
| parent | 63d69bd154987bcc0434e0f85e09bf5dfa07b827 (diff) | |
| download | emacs-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.erts | 12 | ||||
| -rw-r--r-- | test/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 | |||
| 37 | int | 37 | int |
| 38 | main (void) | 38 | main (void) |
| 39 | { | 39 | { |
| 40 | label: | 40 | label: |
| 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 | ||
| 57 | Name: Enum | ||
| 58 | =-= | ||
| 59 | enum | ||
| 60 | week | ||
| 61 | { | ||
| 62 | Mon, Tue, Wed, | ||
| 63 | Thur, Fri, Sat, Sun | ||
| 64 | }; | ||
| 65 | =-=-= | ||
| 66 | |||
| 67 | |||
| 57 | Name: For Loop with Multi-line Condition (GNU Style) | 68 | Name: For Loop with Multi-line Condition (GNU Style) |
| 58 | 69 | ||
| 59 | =-= | 70 | =-= |
| 60 | int main() | 71 | int 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 | ||
| 143 | Name: Type and function name on separate line | ||
| 144 | =-= | ||
| 145 | struct | ||
| 146 | aaa * | ||
| 147 | fn() | ||
| 148 | { | ||
| 149 | }; | ||
| 150 | =-=-= | ||
| 151 | |||
| 130 | Name: Multiline Parameter List (bug#60398) | 152 | Name: 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 | ||
| 226 | Name: Compound Statement after code | 248 | Name: 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) { | |||
| 233 | printf("%d ", v); | 255 | printf("%d ", v); |
| 234 | } | 256 | } |
| 235 | 257 | ||
| 236 | const char *msg = "Hello, world!"; { | 258 | for (int i = 0; |
| 237 | puts("Hello, world!"); | 259 | i < 10; |
| 260 | i++) { | ||
| 261 | IOTA (v, 10) { | ||
| 262 | printf("%d ", v); | ||
| 238 | } | 263 | } |
| 239 | } | 264 | } |
| 240 | 265 | ||
| 266 | { | ||
| 267 | IOTA (v, 10) { | ||
| 268 | printf("%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) |
| 243 | int main() | 274 | int 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 | ||
| 256 | Name: Switch-Case statement | 296 | Name: Switch-Case statement |
| @@ -503,6 +543,16 @@ namespace test { | |||
| 503 | } | 543 | } |
| 504 | =-=-= | 544 | =-=-= |
| 505 | 545 | ||
| 546 | Name: Access specifier | ||
| 547 | =-= | ||
| 548 | class MyClass { | ||
| 549 | public: // Public access specifier | ||
| 550 | int x; // Public attribute | ||
| 551 | private: // Private access specifier | ||
| 552 | int y; // Private attribute | ||
| 553 | }; | ||
| 554 | =-=-= | ||
| 555 | |||
| 506 | Name: Namespace and template (bug#72263) | 556 | Name: Namespace and template (bug#72263) |
| 507 | 557 | ||
| 508 | =-= | 558 | =-= |
| @@ -510,11 +560,13 @@ namespace A { | |||
| 510 | 560 | ||
| 511 | T myfunction1(const char *fname) | 561 | T myfunction1(const char *fname) |
| 512 | { | 562 | { |
| 563 | return a; | ||
| 513 | } | 564 | } |
| 514 | 565 | ||
| 515 | template <class T> | 566 | template <class T> |
| 516 | T myfunction2(const char *fname) | 567 | T myfunction2(const char *fname) |
| 517 | { | 568 | { |
| 569 | return 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 | =-=-= |