]> code.delx.au - gnu-emacs-elpa/commitdiff
tests: Add snippt tests
authorDaiki Ueno <ueno@gnu.org>
Fri, 29 Jan 2016 21:53:31 +0000 (06:53 +0900)
committerDaiki Ueno <ueno@gnu.org>
Fri, 29 Jan 2016 21:53:31 +0000 (06:53 +0900)
gnome-c-tests.el

index a573cd3f1663200c3a5358e6a4bb6be5ee6a56a5..fa13a73bd7a48d4655db6311aafb93ec0e0fbc1e 100644 (file)
@@ -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"))))))