1 (require 'gobject-align)
3 (defconst gobject-test-program-1 "\
4 GGpgCtx *g_gpg_ctx_new (GError **error);
6 typedef void (*GGpgProgressCallback) (gpointer user_data,
12 void g_gpg_ctx_set_progress_callback (GGpgCtx *ctx,
13 GGpgProgressCallback callback,
15 GDestroyNotify destroy_data);
16 void g_gpg_ctx_add_signer (GGpgCtx *ctx, GGpgKey *key);
17 guint g_gpg_ctx_get_n_signers (GGpgCtx *ctx);
18 GGpgKey *g_gpg_ctx_get_signer (GGpgCtx *ctx, guint index);
19 void g_gpg_ctx_clear_signers (GGpgCtx *ctx);
22 (defconst gobject-test-program-1-aligned "\
23 GGpgCtx *g_gpg_ctx_new (GError **error);
25 typedef void (*GGpgProgressCallback) (gpointer user_data,
31 void g_gpg_ctx_set_progress_callback (GGpgCtx *ctx,
32 GGpgProgressCallback callback,
34 GDestroyNotify destroy_data);
35 void g_gpg_ctx_add_signer (GGpgCtx *ctx,
37 guint g_gpg_ctx_get_n_signers (GGpgCtx *ctx);
38 GGpgKey *g_gpg_ctx_get_signer (GGpgCtx *ctx,
40 void g_gpg_ctx_clear_signers (GGpgCtx *ctx);
43 (ert-deftest gobject-test-align--guess-columns ()
44 "Tests the `gobject-align--guess-columns'."
46 (insert gobject-test-program-1)
48 (let ((columns (gobject-align--guess-columns (point-min) (point-max))))
49 (should (= (cdr (assq 'identifier-start-column columns)) 9))
50 (should (= (cdr (assq 'arglist-start-column columns)) 41))
51 (should (= (cdr (assq 'arglist-identifier-start-column columns)) 63)))))
53 (ert-deftest gobject-test-align-region ()
54 "Tests the `gobject-align-region'."
56 (insert gobject-test-program-1)
58 (gobject-align-guess-columns (point-min) (point-max))
59 (gobject-align-region (point-min) (point-max))
60 (should (equal (buffer-string) gobject-test-program-1-aligned))))