[recipes] Fix the ingredient parser tests



commit a93108d3886405cc4afeb6576c8bb6b147dfd33d
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Dec 15 17:27:47 2016 -0500

    Fix the ingredient parser tests

 tests/Makefile.am           |    7 +++++--
 tests/data/valid-1.expected |    4 ++--
 tests/data/valid-2.expected |    2 +-
 tests/data/valid-3.expected |    2 +-
 tests/data/valid-4.expected |    2 +-
 tests/data/valid-5.expected |   30 +++++++++++++++---------------
 tests/ingredients.c         |   14 +++++++++-----
 7 files changed, 34 insertions(+), 27 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6a6942f..9e7144c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,8 +3,11 @@ TESTS = ingredients
 check_PROGRAMS = ingredients
 
 ingredients_SOURCES = ingredients.c
-ingredients_CFLAGS = $(RECIPES_CFLAGS) \
-                       -I$(top_srcdir)/src
+ingredients_CFLAGS = \
+       $(RECIPES_CFLAGS)       \
+       -DPKGDATADIR=\"$(pkgdatadir)\"  \
+       -I$(top_srcdir)/src
+
 ingredients_LDADD = $(RECIPES_LIBS)
 
 -include $(top_srcdir)/git.mk
diff --git a/tests/data/valid-1.expected b/tests/data/valid-1.expected
index 67a9491..ce1bd2f 100644
--- a/tests/data/valid-1.expected
+++ b/tests/data/valid-1.expected
@@ -1,10 +1,10 @@
 AMOUNT 1/1
 UNIT (null)
-NAME apple
+NAME Apple
 
 AMOUNT 2/1
 UNIT (null)
-NAME bananas
+NAME Banana
 
 AMOUNT 3/1
 UNIT box
diff --git a/tests/data/valid-2.expected b/tests/data/valid-2.expected
index 9d3eecf..fec608b 100644
--- a/tests/data/valid-2.expected
+++ b/tests/data/valid-2.expected
@@ -4,7 +4,7 @@ NAME of butter
 
 AMOUNT 2.500000
 UNIT (null)
-NAME eggs
+NAME Egg
 
 AMOUNT 15/1
 UNIT (null)
diff --git a/tests/data/valid-3.expected b/tests/data/valid-3.expected
index 46e262a..3be77a6 100644
--- a/tests/data/valid-3.expected
+++ b/tests/data/valid-3.expected
@@ -1,6 +1,6 @@
 AMOUNT 2.123000
 UNIT l
-NAME of red wine
+NAME Wine
 
 AMOUNT 1/2
 UNIT g
diff --git a/tests/data/valid-4.expected b/tests/data/valid-4.expected
index 0d6fdca..c04a3e3 100644
--- a/tests/data/valid-4.expected
+++ b/tests/data/valid-4.expected
@@ -8,7 +8,7 @@ NAME of salt
 
 AMOUNT 3/1
 UNIT l
-NAME of wine
+NAME Wine
 
 AMOUNT 4/1
 UNIT l
diff --git a/tests/data/valid-5.expected b/tests/data/valid-5.expected
index cc8624c..6f67ad6 100644
--- a/tests/data/valid-5.expected
+++ b/tests/data/valid-5.expected
@@ -1,60 +1,60 @@
 AMOUNT 1/1
 UNIT (null)
-NAME apple
+NAME Apple
 
 AMOUNT 1/1
 UNIT (null)
-NAME apple
+NAME Apple
 
 AMOUNT 1/1
 UNIT (null)
-NAME apple
+NAME Apple
 
 AMOUNT 2/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 3/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 4/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 5/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 6/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 7/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 8/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 9/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 10/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 11/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 12/1
 UNIT (null)
-NAME apples
+NAME Apple
 
 AMOUNT 12/1
 UNIT (null)
-NAME apples
+NAME Apple
 
diff --git a/tests/ingredients.c b/tests/ingredients.c
index e3fccd7..8db7dfc 100644
--- a/tests/ingredients.c
+++ b/tests/ingredients.c
@@ -19,8 +19,12 @@
 #include "config.h"
 #include <locale.h>
 #include <glib.h>
-#include "gr-ingredients.h"
-#include "gr-ingredients.c"
+#include "gr-ingredients-list.h"
+#include "gr-ingredients-list.c"
+#include "gr-ingredient.h"
+#include "gr-ingredient.c"
+#include "gr-utils.h"
+#include "gr-utils.c"
 
 static GString *string;
 
@@ -36,14 +40,14 @@ test_file (const char *filename)
                 return 1;
         }
 
-        if (!gr_ingredients_validate (contents, &error)) {
+        if (!gr_ingredients_list_validate (contents, &error)) {
                 g_string_append_printf (string, "ERROR %s\n", error->message);
         }
         else {
-                g_autoptr(GrIngredients) ingredients = NULL;
+                g_autoptr(GrIngredientsList) ingredients = NULL;
                 GList *l;
 
-                ingredients = gr_ingredients_new (contents);
+                ingredients = gr_ingredients_list_new (contents);
                 for (l = ingredients->ingredients; l; l = l->next) {
                         Ingredient *ing = (Ingredient *)l->data;
                         if (ing->fraction)


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