]> code.delx.au - gnu-emacs-elpa/blobdiff - gnome-tests.el
align: Reimplement d6086809
[gnu-emacs-elpa] / gnome-tests.el
index d4e3113695b97aa7cf71dce5156c19f9d13dcba4..403e0b1785272ddc24be64c8f2527fd7b2d4a00d 100644 (file)
@@ -20,7 +20,7 @@ void g_gpg_ctx_clear_signers (GGpgCtx *ctx);
 ")
 
 (defconst gnome-test-program-1-aligned "\
-GGpgCtx *g_gpg_ctx_new                   (GError             **error);
+GGpgCtx *g_gpg_ctx_new                   (GError              **error);
 
 typedef void (*GGpgProgressCallback) (gpointer user_data,
                                       const gchar *what,
@@ -28,16 +28,16 @@ typedef void (*GGpgProgressCallback) (gpointer user_data,
                                       gint current,
                                       gint total);
 
-void     g_gpg_ctx_set_progress_callback (GGpgCtx             *ctx,
-                                          GGpgProgressCallback callback,
-                                          gpointer             user_data,
-                                          GDestroyNotify       destroy_data);
-void     g_gpg_ctx_add_signer            (GGpgCtx             *ctx,
-                                          GGpgKey             *key);
-guint    g_gpg_ctx_get_n_signers         (GGpgCtx             *ctx);
-GGpgKey *g_gpg_ctx_get_signer            (GGpgCtx             *ctx,
-                                          guint                index);
-void     g_gpg_ctx_clear_signers         (GGpgCtx             *ctx);
+void     g_gpg_ctx_set_progress_callback (GGpgCtx              *ctx,
+                                          GGpgProgressCallback  callback,
+                                          gpointer              user_data,
+                                          GDestroyNotify        destroy_data);
+void     g_gpg_ctx_add_signer            (GGpgCtx              *ctx,
+                                          GGpgKey              *key);
+guint    g_gpg_ctx_get_n_signers         (GGpgCtx              *ctx);
+GGpgKey *g_gpg_ctx_get_signer            (GGpgCtx              *ctx,
+                                          guint                 index);
+void     g_gpg_ctx_clear_signers         (GGpgCtx              *ctx);
 ")
 
 (defconst gnome-test-program-2 "\
@@ -57,6 +57,18 @@ const gchar **          gtk_widget_list_action_prefixes (GtkWidget             *
                                          GParamSpec     *pspec);
 ")
 
+(defconst gnome-test-program-4 "\
+FOO_AVAILABLE_IN_ALL
+int foo (struct foo ***a, int b, ...) G_GNUC_CONST;
+")
+
+(defconst gnome-test-program-4-aligned "\
+FOO_AVAILABLE_IN_ALL
+int foo (struct foo ***a,
+         int           b,
+         ...) G_GNUC_CONST;
+")
+
 (ert-deftest gnome-test-align--compute-optimal-columns ()
   "Tests the `gnome-align--compute-optimal-columns'."
   (with-temp-buffer
@@ -65,7 +77,7 @@ const gchar **          gtk_widget_list_action_prefixes (GtkWidget             *
     (let ((columns (gnome-align--compute-optimal-columns (point-min) (point-max))))
       (should (= (cdr (assq 'identifier-start-column columns)) 9))
       (should (= (cdr (assq 'arglist-start-column columns)) 41))
-      (should (= (cdr (assq 'arglist-identifier-start-column columns)) 63)))))
+      (should (= (cdr (assq 'arglist-identifier-start-column columns)) 64)))))
 
 (ert-deftest gnome-test-align-region ()
   "Tests the `gnome-align-region'."
@@ -76,6 +88,15 @@ const gchar **          gtk_widget_list_action_prefixes (GtkWidget             *
     (gnome-align-region (point-min) (point-max))
     (should (equal (buffer-string) gnome-test-program-1-aligned))))
 
+(ert-deftest gnome-test-align-region-2 ()
+  "Tests the `gnome-align-region'."
+  (with-temp-buffer
+    (insert gnome-test-program-4)
+    (c-mode)
+    (gnome-align-compute-optimal-columns (point-min) (point-max))
+    (gnome-align-region (point-min) (point-max))
+    (should (equal (buffer-string) gnome-test-program-4-aligned))))
+
 (ert-deftest gnome-test-align-guess-columns-1 ()
   "Tests the `gnome-align-guess-columns'."
   (with-temp-buffer