From f3c2b2284e63ce7de90ca9335792bf6c570fc99b Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Sat, 30 Jan 2016 06:53:31 +0900 Subject: [PATCH] tests: Add snippt tests --- gnome-c-tests.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gnome-c-tests.el b/gnome-c-tests.el index a573cd3f1..fa13a73bd 100644 --- a/gnome-c-tests.el +++ b/gnome-c-tests.el @@ -22,6 +22,7 @@ ;;; Code: (require 'gnome-c-align) +(require 'gnome-c-snippet) (defconst gnome-c-test-program-1 "\ GGpgCtx *g_gpg_ctx_new (GError **error); @@ -129,6 +130,11 @@ int identifier_1234567890 double b); ") +(defconst gnome-c-test-program-7 "\ +G_DECLARE_FINAL_TYPE (GGpgEngineInfo, g_gpg_engine_info, G_GPG, ENGINE_INFO, + GObject) +") + (ert-deftest gnome-c-test-align--guess-optimal-columns () "Tests the `gnome-c-align--guess-optimal-columns'." (with-temp-buffer @@ -212,3 +218,14 @@ int identifier_1234567890 (should (= gnome-c-align-identifier-start-column 13)) (should (= gnome-c-align-arglist-start-column 40)) (should (= gnome-c-align-arglist-identifier-start-column 57)))) + +(ert-deftest gnome-c-test-snippet-guess-name-from-declaration () + "Tests the `gnome-c-snippet--guess-name-from-declaration'." + (with-temp-buffer + (insert gnome-c-test-program-7) + (c-mode) + (setq buffer-file-name "gpgme-glib.h") + (let ((package (gnome-c-snippet--guess-name-from-declaration 'package)) + (class (gnome-c-snippet--guess-name-from-declaration 'class))) + (should (equal package '("G" "Gpg"))) + (should (equal class '("Engine" "Info")))))) -- 2.39.2