;;; Code:
(require 'gnome-c-align)
+(require 'gnome-c-snippet)
(defconst gnome-c-test-program-1 "\
GGpgCtx *g_gpg_ctx_new (GError **error);
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
(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"))))))