[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 870e78c 12/40: Add ERT tests
From: |
Daiki Ueno |
Subject: |
[elpa] master 870e78c 12/40: Add ERT tests |
Date: |
Fri, 22 Jan 2016 22:48:38 +0000 |
branch: master
commit 870e78c5cd1c65fbdb76c4d7cea6c9f2b471fd9b
Author: Daiki Ueno <address@hidden>
Commit: Daiki Ueno <address@hidden>
Add ERT tests
---
Makefile | 4 +++
gobject-tests.el | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 9dc59b1..097b25e 100644
--- a/Makefile
+++ b/Makefile
@@ -8,5 +8,9 @@ all: $(ELC)
$(EMACS) -Q -batch --eval "(setq load-path (cons nil load-path))" \
-f batch-byte-compile $<
+check:
+ $(EMACS) -Q -batch --eval "(setq load-path (cons nil load-path))" \
+ -l ert -l gobject-tests.el -f ert-run-tests-batch-and-exit
+
clean:
$(RM) -rf $(ELC)
diff --git a/gobject-tests.el b/gobject-tests.el
new file mode 100644
index 0000000..500b641
--- /dev/null
+++ b/gobject-tests.el
@@ -0,0 +1,60 @@
+(require 'gobject-align)
+
+(defconst gobject-test-program-1 "\
+GGpgCtx *g_gpg_ctx_new (GError **error);
+
+typedef void (*GGpgProgressCallback) (gpointer user_data,
+ const gchar *what,
+ gint type,
+ 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);
+")
+
+(defconst gobject-test-program-1-aligned "\
+GGpgCtx *g_gpg_ctx_new (GError **error);
+
+typedef void (*GGpgProgressCallback) (gpointer user_data,
+ const gchar *what,
+ gint type,
+ 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);
+")
+
+(ert-deftest gobject-test-align--guess-columns ()
+ "Tests the `gobject-align--guess-columns'."
+ (with-temp-buffer
+ (insert gobject-test-program-1)
+ (c-mode)
+ (let ((columns (gobject-align--guess-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)))))
+
+(ert-deftest gobject-test-align-region ()
+ "Tests the `gobject-align-region'."
+ (with-temp-buffer
+ (insert gobject-test-program-1)
+ (c-mode)
+ (gobject-align-guess-columns (point-min) (point-max))
+ (gobject-align-region (point-min) (point-max))
+ (should (equal (buffer-string) gobject-test-program-1-aligned))))
- [elpa] master f0f8217 02/40: Use table in README.md, (continued)
- [elpa] master f0f8217 02/40: Use table in README.md, Daiki Ueno, 2016/01/22
- [elpa] master 180cd98 04/40: align: Ignore some G_* symbols, Daiki Ueno, 2016/01/22
- [elpa] master 6c5bda5 05/40: align: Fix off-by-one when adding newline, Daiki Ueno, 2016/01/22
- [elpa] master a0fbb58 06/40: align: Fix off-by-one in positioning argument, Daiki Ueno, 2016/01/22
- [elpa] master 0d84312 08/40: Fix wording in README.md, Daiki Ueno, 2016/01/22
- [elpa] master 6a12630 07/40: Add examples to README.md, Daiki Ueno, 2016/01/22
- [elpa] master 8579586 10/40: align: Minor refactoring, Daiki Ueno, 2016/01/22
- [elpa] master ea42394 09/40: Fix wording in README.md, Daiki Ueno, 2016/01/22
- [elpa] master dcb6a2e 03/40: align: Support guessing/setting alignment rules, Daiki Ueno, 2016/01/22
- [elpa] master 2f5707d 11/40: align: Fix previous commit, Daiki Ueno, 2016/01/22
- [elpa] master 870e78c 12/40: Add ERT tests,
Daiki Ueno <=
- [elpa] master 7285abe 15/40: Reorder commands in README.md, Daiki Ueno, 2016/01/22
- [elpa] master 1ad58dc 01/40: Initial import, Daiki Ueno, 2016/01/22
- [elpa] master b4d4672 14/40: align: Support vfuncs, Daiki Ueno, 2016/01/22
- [elpa] master ae40679 18/40: Add symlink to README, Daiki Ueno, 2016/01/22
- [elpa] master 1e67806 19/40: snippet: Make options customizable, Daiki Ueno, 2016/01/22
- [elpa] master e8714b1 13/40: align: -guess-columns -> -compute-optimal-columns, Daiki Ueno, 2016/01/22
- [elpa] master abb9dd4 21/40: Revert "align: Add a room before '*' for arguments", Daiki Ueno, 2016/01/22
- [elpa] master d608680 20/40: align: Add a room before '*' for arguments, Daiki Ueno, 2016/01/22
- [elpa] master 147931d 27/40: Fix typo, Daiki Ueno, 2016/01/22
- [elpa] master ec40108 23/40: align: Use `max' as much as possible, Daiki Ueno, 2016/01/22