]> git.eshelyaron.com Git - emacs.git/commitdiff
Add more c-ts-mode indent tests
authorYuan Fu <casouri@gmail.com>
Sun, 1 Dec 2024 07:49:14 +0000 (23:49 -0800)
committerEshel Yaron <me@eshelyaron.com>
Wed, 4 Dec 2024 17:04:36 +0000 (18:04 +0100)
* 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)

test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
test/lisp/progmodes/c-ts-mode-resources/indent.erts

index fa65ba83a69d4aebad8f9f53ca55e602e6d4d321..0f6f87800ecd11f09fc87f94313e2c6bcae50c25 100644 (file)
@@ -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;
     }
   }
 }
index 2f3540c39705b5b7160bd15998bf3b28d4c63506..691f5b6ecfdc227283e8c613f8b4759b8e425602 100644 (file)
@@ -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 <class T>
 T myfunction2(const char *fname)
 {
+return a;
 }
 }
 =-=
@@ -492,11 +574,13 @@ namespace A {
 
   T myfunction1(const char *fname)
   {
+    return a;
   }
 
   template <class T>
   T myfunction2(const char *fname)
   {
+    return a;
   }
 }
 =-=-=