[gnome-builder] ctags: add test for lookup_prefix



commit 96facef0a3b1645df901e7a37e3f036142f6eb6e
Author: Christian Hergert <christian hergert me>
Date:   Fri May 15 17:23:55 2015 -0700

    ctags: add test for lookup_prefix

 libide/ctags/ide-ctags-index.c |   12 ++++++------
 tests/test-ide-ctags.c         |    6 ++++++
 2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/libide/ctags/ide-ctags-index.c b/libide/ctags/ide-ctags-index.c
index 59bd48f..54bd6ba 100644
--- a/libide/ctags/ide-ctags-index.c
+++ b/libide/ctags/ide-ctags-index.c
@@ -481,18 +481,18 @@ ide_ctags_index_lookup_full (IdeCtagsIndex *self,
 }
 
 const IdeCtagsIndexEntry *
-ide_ctags_index_lookup (IdeCtagsIndex         *self,
-                        const gchar           *keyword,
-                        gsize                 *length)
+ide_ctags_index_lookup (IdeCtagsIndex *self,
+                        const gchar   *keyword,
+                        gsize         *length)
 {
   return ide_ctags_index_lookup_full (self, keyword, length,
                                       ide_ctags_index_entry_compare_keyword);
 }
 
 const IdeCtagsIndexEntry *
-ide_ctags_index_lookup_prefix (IdeCtagsIndex         *self,
-                               const gchar           *keyword,
-                               gsize                 *length)
+ide_ctags_index_lookup_prefix (IdeCtagsIndex *self,
+                               const gchar   *keyword,
+                               gsize         *length)
 {
   return ide_ctags_index_lookup_full (self, keyword, length,
                                       ide_ctags_index_entry_compare_prefix);
diff --git a/tests/test-ide-ctags.c b/tests/test-ide-ctags.c
index 4ccad5f..0bad11e 100644
--- a/tests/test-ide-ctags.c
+++ b/tests/test-ide-ctags.c
@@ -62,6 +62,12 @@ init_cb (GObject      *object,
   g_assert_cmpstr (entries->name, ==, "IdeDiagnosticProvider.functions");
   g_assert_cmpint (entries->kind, ==, IDE_CTAGS_INDEX_ENTRY_ANCHOR);
 
+  entries = ide_ctags_index_lookup_prefix (index, "Ide", &n_entries);
+  g_assert_cmpint (n_entries, ==, 815);
+  g_assert (entries != NULL);
+  for (i = 0; i < 815; i++)
+    g_assert (g_str_has_prefix (entries [i].name, "Ide"));
+
   g_main_loop_quit (gMainLoop);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]