emacs-diffs
[Top][All Lists]
Advanced

[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;
   }
 }
 =-=-=



reply via email to

[Prev in Thread] Current Thread [Next in Thread]