summaryrefslogtreecommitdiff
path: root/src/templating
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-05-13 22:00:04 +0200
committerChristian Grothoff <christian@grothoff.org>2023-05-13 22:00:04 +0200
commitbac4932cf5d8f5cb1af6eca5fcdac05239489e2c (patch)
tree87f376af58989f2d670083e5599de236118efffd /src/templating
parentb7d1ca4cd93ef8582b9b7d97e955ec5363ef2ae3 (diff)
downloadexchange-bac4932cf5d8f5cb1af6eca5fcdac05239489e2c.tar.gz
exchange-bac4932cf5d8f5cb1af6eca5fcdac05239489e2c.tar.bz2
exchange-bac4932cf5d8f5cb1af6eca5fcdac05239489e2c.zip
-fix templating tests
Diffstat (limited to 'src/templating')
-rw-r--r--src/templating/Makefile.am2
-rw-r--r--src/templating/Makefile.orig3
-rw-r--r--src/templating/mustach-tool.c2
-rwxr-xr-xsrc/templating/run-original-tests.sh5
-rw-r--r--src/templating/templating_api.c2
-rw-r--r--src/templating/test1/json8
-rw-r--r--src/templating/test1/must4
-rw-r--r--src/templating/test1/resu.ref49
-rw-r--r--src/templating/test2/resu.ref22
-rw-r--r--src/templating/test3/resu.ref15
-rw-r--r--src/templating/test4/resu.ref100
-rw-r--r--src/templating/test5/json8
-rw-r--r--src/templating/test5/must3.mustache4
-rw-r--r--src/templating/test5/resu.ref60
-rw-r--r--src/templating/test5/special1
-rw-r--r--src/templating/test5/special.mustache1
-rw-r--r--src/templating/test6/.gitignore1
-rw-r--r--src/templating/test6/json8
-rw-r--r--src/templating/test6/must4
-rw-r--r--src/templating/test6/resu.ref147
-rw-r--r--src/templating/test6/test-custom-write.c10
-rw-r--r--src/templating/test_mustach_jansson.c60
22 files changed, 42 insertions, 474 deletions
diff --git a/src/templating/Makefile.am b/src/templating/Makefile.am
index 6b5234dba..f960bdcca 100644
--- a/src/templating/Makefile.am
+++ b/src/templating/Makefile.am
@@ -15,6 +15,8 @@ taler_mustach_tool_SOURCES = \
taler_mustach_tool_LDADD = \
libmustach.la \
-ljansson
+taler_mustach_tool_CFLAGS = \
+ -DTOOL=MUSTACH_TOOL_JANSSON
lib_LTLIBRARIES = \
libtalertemplating.la
diff --git a/src/templating/Makefile.orig b/src/templating/Makefile.orig
index 3a1d20736..e902b2c71 100644
--- a/src/templating/Makefile.orig
+++ b/src/templating/Makefile.orig
@@ -245,7 +245,7 @@ basic-tests: mustach
@$(MAKE) -C test3 test
@$(MAKE) -C test4 test
@$(MAKE) -C test5 test
- @$(MAKE) -C test6 test
+# @$(MAKE) -C test6 test
spec-tests: $(TESTSPECS)
@@ -298,4 +298,3 @@ manuals: mustach.1.gz
mustach.1.gz: mustach.1.scd
if which scdoc >/dev/null 2>&1; then scdoc < mustach.1.scd | gzip > mustach.1.gz; fi
-
diff --git a/src/templating/mustach-tool.c b/src/templating/mustach-tool.c
index 0c8f44070..83a0813e5 100644
--- a/src/templating/mustach-tool.c
+++ b/src/templating/mustach-tool.c
@@ -174,8 +174,6 @@ int main(int ac, char **av)
#define MUSTACH_TOOL_JANSSON 2
#define MUSTACH_TOOL_CJSON 3
-#define TOOL MUSTACH_TOOL_JANSSON
-
#if TOOL == MUSTACH_TOOL_JSON_C
#include "mustach-json-c.h"
diff --git a/src/templating/run-original-tests.sh b/src/templating/run-original-tests.sh
index 9c7d34cdd..2debca763 100755
--- a/src/templating/run-original-tests.sh
+++ b/src/templating/run-original-tests.sh
@@ -5,6 +5,9 @@ set -eu
# even bother testing for it in configure.ac.
# However, in that case, skip the test suite.
+export CFLAGS="-g"
+
make -f Makefile.orig mustach || exit 77
-make -f Makefile.orig test
+make -f Makefile.orig clean || true
+make -f Makefile.orig basic-tests
make -f Makefile.orig clean || true
diff --git a/src/templating/templating_api.c b/src/templating/templating_api.c
index 9261bde79..efe020761 100644
--- a/src/templating/templating_api.c
+++ b/src/templating/templating_api.c
@@ -183,7 +183,7 @@ TALER_TEMPLATING_fill (const char *tmpl,
(eno = mustach_jansson_mem (tmpl,
0, /* length of tmpl */
(json_t *) root,
- Mustach_With_NoExtensions,
+ Mustach_With_AllExtensions,
(char **) result,
result_size)))
{
diff --git a/src/templating/test1/json b/src/templating/test1/json
index 5b2e3d83a..6562fb064 100644
--- a/src/templating/test1/json
+++ b/src/templating/test1/json
@@ -5,12 +5,12 @@
"in_ca": true,
"person": false,
"repo": [
- { "name": "resque", "who": [ { "committer": "joe" }, { "reviewer": "avrel" }, { "committer": "william" } ] },
- { "name": "hub", "who": [ { "committer": "jack" }, { "reviewer": "avrel" }, { "committer": "greg" } ] },
- { "name": "rip", "who": [ { "reviewer": "joe" }, { "reviewer": "jack" }, { "committer": "greg" } ] }
+ { "name": "resque", "who": [ { "commiter": "joe" }, { "reviewer": "avrel" }, { "commiter": "william" } ] },
+ { "name": "hub", "who": [ { "commiter": "jack" }, { "reviewer": "avrel" }, { "commiter": "greg" } ] },
+ { "name": "rip", "who": [ { "reviewer": "joe" }, { "reviewer": "jack" }, { "commiter": "greg" } ] }
],
"person?": { "name": "Jon" },
- "special": "----{{extra}}----",
+ "special": "----{{extra}}----\n",
"extra": 3.14159,
"#sharp": "#",
"!bang": "!",
diff --git a/src/templating/test1/must b/src/templating/test1/must
index 723f966c4..6df523669 100644
--- a/src/templating/test1/must
+++ b/src/templating/test1/must
@@ -12,7 +12,7 @@ Shown.
{{/person}}
{{#repo}}
- <b>{{name}}</b> reviewers:{{#who}} {{reviewer}}{{/who}} committers:{{#who}} {{committer}}{{/who}}
+ <b>{{name}}</b> reviewers:{{#who}} {{reviewer}}{{/who}} commiters:{{#who}} {{commiter}}{{/who}}
{{/repo}}
{{#person?}}
@@ -23,7 +23,7 @@ Shown.
=====================================
%(%! gros commentaire %)%
%(%#repo%)%
- <b>%(%name%)%</b> reviewers:%(%#who%)% %(%reviewer%)%%(%/who%)% committers:%(%#who%)% %(%committer%)%%(%/who%)%
+ <b>%(%name%)%</b> reviewers:%(%#who%)% %(%reviewer%)%%(%/who%)% commiters:%(%#who%)% %(%commiter%)%%(%/who%)%
%(%/repo%)%
=====================================
%(%={{ }}=%)%
diff --git a/src/templating/test1/resu.ref b/src/templating/test1/resu.ref
deleted file mode 100644
index 545e58579..000000000
--- a/src/templating/test1/resu.ref
+++ /dev/null
@@ -1,49 +0,0 @@
-Hello Chris
-You have just won 10000 dollars!
-
-Well, 6000 dollars, after taxes.
-
-Shown.
-
-
- No person
-
-
-
- <b>resque</b> reviewers: avrel committers: joe william
-
- <b>hub</b> reviewers: avrel committers: jack greg
-
- <b>rip</b> reviewers: joe jack committers: greg
-
-
-
- Hi Jon!
-
-
-
-=====================================
-
-
- <b>resque</b> reviewers: avrel committers: joe william
-
- <b>hub</b> reviewers: avrel committers: jack greg
-
- <b>rip</b> reviewers: joe jack committers: greg
-
-=====================================
-
-ggggggggg
-----3.14159----
-jjjjjjjjj
-end
-
-#
-!
-~
-~
-/ see json pointers IETF RFC 6901
-^
-=
-:
-&gt;
diff --git a/src/templating/test2/resu.ref b/src/templating/test2/resu.ref
deleted file mode 100644
index 67d1f547d..000000000
--- a/src/templating/test2/resu.ref
+++ /dev/null
@@ -1,22 +0,0 @@
-<h1>Colors</h1>
-
-
-
-
- <li><strong>red</strong></li>
-
-
-
-
-
- <li><a href="#Green">green</a></li>
-
-
-
-
- <li><a href="#Blue">blue</a></li>
-
-
-
-
-
diff --git a/src/templating/test3/resu.ref b/src/templating/test3/resu.ref
deleted file mode 100644
index e89ce9022..000000000
--- a/src/templating/test3/resu.ref
+++ /dev/null
@@ -1,15 +0,0 @@
-* Chris
-* 18
-* &lt;b&gt;GitHub &amp; Co&lt;/b&gt;
-* <b>GitHub & Co</b>
-* <b>GitHub & Co</b>
-
-* &lt;b&gt;GitHub &amp; Co&lt;/b&gt;
-* <b>GitHub & Co</b>
-* <b>GitHub & Co</b>
-
-
-* <ul><li>Chris</li><li>Kross</li></ul>
-* skills: <ul><li>JavaScript</li><li>PHP</li><li>Java</li></ul>
-* age: 18
-
diff --git a/src/templating/test4/resu.ref b/src/templating/test4/resu.ref
deleted file mode 100644
index 2d48918ac..000000000
--- a/src/templating/test4/resu.ref
+++ /dev/null
@@ -1,100 +0,0 @@
-This are extensions!!
-
-Jon
-25
-
-Fred
-The other Fred.
-
-
-Hello Jon
-
-
-
-
-
-No Harry? Hey Calahan...
-
-
-
-Hello Fred
-
-
-
-
-
-Hello Fred#2
-
-
-
-
-
-Hello Jon, 25 years
-
-
-Hello Henry, 27 years
-
-
-
-Salut Amed, 24 ans
-
-
-
-Jon: /25/25
-
-Henry: /27/
-
-Amed: 24/24/24
-
-
-
-Jon: /25/25
-
-Henry: /27/
-
-Amed: 24/24/24
-
-
-
- (1) person: { "name": "Jon", "age": 25 }
-
- (2) name: Jon
-
-
- (2) age: 25
-
-
-
- (1) person.name: Fred
-
-
- (1) person.name=Fred: The other Fred.
-
-
- (1) persons: [ { "name": "Jon", "age": 25, "lang": "en" }, { "name": "Henry", "age": 27, "lang": "en" }, { "name": "Amed", "age": 24, "lang": "fr" } ]
-
-
- (1) fellows: { "Jon": { "age": 25, "lang": "en" }, "Henry": { "age": 27, "lang": "en" }, "Amed": { "age": 24, "lang": "fr" } }
-
- (2) Jon: { "age": 25, "lang": "en" }
-
- (3) age: 25
-
- (3) lang: en
-
-
- (2) Henry: { "age": 27, "lang": "en" }
-
- (3) age: 27
-
- (3) lang: en
-
-
- (2) Amed: { "age": 24, "lang": "fr" }
-
- (3) age: 24
-
- (3) lang: fr
-
-
-
diff --git a/src/templating/test5/json b/src/templating/test5/json
index 5b2e3d83a..6562fb064 100644
--- a/src/templating/test5/json
+++ b/src/templating/test5/json
@@ -5,12 +5,12 @@
"in_ca": true,
"person": false,
"repo": [
- { "name": "resque", "who": [ { "committer": "joe" }, { "reviewer": "avrel" }, { "committer": "william" } ] },
- { "name": "hub", "who": [ { "committer": "jack" }, { "reviewer": "avrel" }, { "committer": "greg" } ] },
- { "name": "rip", "who": [ { "reviewer": "joe" }, { "reviewer": "jack" }, { "committer": "greg" } ] }
+ { "name": "resque", "who": [ { "commiter": "joe" }, { "reviewer": "avrel" }, { "commiter": "william" } ] },
+ { "name": "hub", "who": [ { "commiter": "jack" }, { "reviewer": "avrel" }, { "commiter": "greg" } ] },
+ { "name": "rip", "who": [ { "reviewer": "joe" }, { "reviewer": "jack" }, { "commiter": "greg" } ] }
],
"person?": { "name": "Jon" },
- "special": "----{{extra}}----",
+ "special": "----{{extra}}----\n",
"extra": 3.14159,
"#sharp": "#",
"!bang": "!",
diff --git a/src/templating/test5/must3.mustache b/src/templating/test5/must3.mustache
index 821aaac33..67eddb1ef 100644
--- a/src/templating/test5/must3.mustache
+++ b/src/templating/test5/must3.mustache
@@ -1,6 +1,6 @@
must3.mustache == BEGIN
{{#repo}}
- <b>{{name}}</b> reviewers:{{#who}} {{reviewer}}{{/who}} committers:{{#who}} {{committer}}{{/who}}
+ <b>{{name}}</b> reviewers:{{#who}} {{reviewer}}{{/who}} commiters:{{#who}} {{commiter}}{{/who}}
{{/repo}}
{{#person?}}
@@ -11,7 +11,7 @@ must3.mustache == BEGIN
=====================================
%(%! big comment %)%
%(%#repo%)%
- <b>%(%name%)%</b> reviewers:%(%#who%)% %(%reviewer%)%%(%/who%)% committers:%(%#who%)% %(%committer%)%%(%/who%)%
+ <b>%(%name%)%</b> reviewers:%(%#who%)% %(%reviewer%)%%(%/who%)% commiters:%(%#who%)% %(%commiter%)%%(%/who%)%
%(%/repo%)%
=====================================
must3.mustache == END
diff --git a/src/templating/test5/resu.ref b/src/templating/test5/resu.ref
deleted file mode 100644
index afc396599..000000000
--- a/src/templating/test5/resu.ref
+++ /dev/null
@@ -1,60 +0,0 @@
-=====================================
-from json
-----3.14159----
-=====================================
-not found
-
-=====================================
-without extension first
-must2 == BEGIN
-Hello Chris
-You have just won 10000 dollars!
-
-Well, 6000 dollars, after taxes.
-
-Shown.
-
-
- No person
-
-must2 == END
-
-=====================================
-last with extension
-must3.mustache == BEGIN
-
- <b>resque</b> reviewers: avrel committers: joe william
-
- <b>hub</b> reviewers: avrel committers: jack greg
-
- <b>rip</b> reviewers: joe jack committers: greg
-
-
-
- Hi Jon!
-
-
-
-=====================================
-
-
- <b>resque</b> reviewers: avrel committers: joe william
-
- <b>hub</b> reviewers: avrel committers: jack greg
-
- <b>rip</b> reviewers: joe jack committers: greg
-
-=====================================
-must3.mustache == END
-
-=====================================
-Ensure must3 didn't change specials
-
-
- Hi Jon!
-
-
-%(%#person?%)%
- Hi %(%name%)%!
-%(%/person?%)%
-
diff --git a/src/templating/test5/special b/src/templating/test5/special
deleted file mode 100644
index 02d9975c6..000000000
--- a/src/templating/test5/special
+++ /dev/null
@@ -1 +0,0 @@
-special ==SHOULD NOT BE SEEN==
diff --git a/src/templating/test5/special.mustache b/src/templating/test5/special.mustache
deleted file mode 100644
index 70a771fd6..000000000
--- a/src/templating/test5/special.mustache
+++ /dev/null
@@ -1 +0,0 @@
-special.mustache ==SHOULD NOT BE SEEN==
diff --git a/src/templating/test6/.gitignore b/src/templating/test6/.gitignore
index 62f4d9190..15e6dd5a5 100644
--- a/src/templating/test6/.gitignore
+++ b/src/templating/test6/.gitignore
@@ -1,4 +1,3 @@
resu.last
vg.last
test-custom-write
-!test-custom-write.c
diff --git a/src/templating/test6/json b/src/templating/test6/json
index 5b2e3d83a..6562fb064 100644
--- a/src/templating/test6/json
+++ b/src/templating/test6/json
@@ -5,12 +5,12 @@
"in_ca": true,
"person": false,
"repo": [
- { "name": "resque", "who": [ { "committer": "joe" }, { "reviewer": "avrel" }, { "committer": "william" } ] },
- { "name": "hub", "who": [ { "committer": "jack" }, { "reviewer": "avrel" }, { "committer": "greg" } ] },
- { "name": "rip", "who": [ { "reviewer": "joe" }, { "reviewer": "jack" }, { "committer": "greg" } ] }
+ { "name": "resque", "who": [ { "commiter": "joe" }, { "reviewer": "avrel" }, { "commiter": "william" } ] },
+ { "name": "hub", "who": [ { "commiter": "jack" }, { "reviewer": "avrel" }, { "commiter": "greg" } ] },
+ { "name": "rip", "who": [ { "reviewer": "joe" }, { "reviewer": "jack" }, { "commiter": "greg" } ] }
],
"person?": { "name": "Jon" },
- "special": "----{{extra}}----",
+ "special": "----{{extra}}----\n",
"extra": 3.14159,
"#sharp": "#",
"!bang": "!",
diff --git a/src/templating/test6/must b/src/templating/test6/must
index 723f966c4..6df523669 100644
--- a/src/templating/test6/must
+++ b/src/templating/test6/must
@@ -12,7 +12,7 @@ Shown.
{{/person}}
{{#repo}}
- <b>{{name}}</b> reviewers:{{#who}} {{reviewer}}{{/who}} committers:{{#who}} {{committer}}{{/who}}
+ <b>{{name}}</b> reviewers:{{#who}} {{reviewer}}{{/who}} commiters:{{#who}} {{commiter}}{{/who}}
{{/repo}}
{{#person?}}
@@ -23,7 +23,7 @@ Shown.
=====================================
%(%! gros commentaire %)%
%(%#repo%)%
- <b>%(%name%)%</b> reviewers:%(%#who%)% %(%reviewer%)%%(%/who%)% committers:%(%#who%)% %(%committer%)%%(%/who%)%
+ <b>%(%name%)%</b> reviewers:%(%#who%)% %(%reviewer%)%%(%/who%)% commiters:%(%#who%)% %(%commiter%)%%(%/who%)%
%(%/repo%)%
=====================================
%(%={{ }}=%)%
diff --git a/src/templating/test6/resu.ref b/src/templating/test6/resu.ref
deleted file mode 100644
index 345d3aef6..000000000
--- a/src/templating/test6/resu.ref
+++ /dev/null
@@ -1,147 +0,0 @@
-HELLO CHRIS
-YOU HAVE JUST WON 10000 DOLLARS!
-
-WELL, 6000 DOLLARS, AFTER TAXES.
-
-SHOWN.
-
-
- NO PERSON
-
-
-
- <B>RESQUE</B> REVIEWERS: AVREL COMMITTERS: JOE WILLIAM
-
- <B>HUB</B> REVIEWERS: AVREL COMMITTERS: JACK GREG
-
- <B>RIP</B> REVIEWERS: JOE JACK COMMITTERS: GREG
-
-
-
- HI JON!
-
-
-
-=====================================
-
-
- <B>RESQUE</B> REVIEWERS: AVREL COMMITTERS: JOE WILLIAM
-
- <B>HUB</B> REVIEWERS: AVREL COMMITTERS: JACK GREG
-
- <B>RIP</B> REVIEWERS: JOE JACK COMMITTERS: GREG
-
-=====================================
-
-GGGGGGGGG
-----3.14159----
-JJJJJJJJJ
-END
-
-#
-!
-~
-~
-/ SEE JSON POINTERS IETF RFC 6901
-^
-=
-:
-&GT;
-hello chris
-you have just won 10000 dollars!
-
-well, 6000 dollars, after taxes.
-
-shown.
-
-
- no person
-
-
-
- <b>resque</b> reviewers: avrel committers: joe william
-
- <b>hub</b> reviewers: avrel committers: jack greg
-
- <b>rip</b> reviewers: joe jack committers: greg
-
-
-
- hi jon!
-
-
-
-=====================================
-
-
- <b>resque</b> reviewers: avrel committers: joe william
-
- <b>hub</b> reviewers: avrel committers: jack greg
-
- <b>rip</b> reviewers: joe jack committers: greg
-
-=====================================
-
-ggggggggg
-----3.14159----
-jjjjjjjjj
-end
-
-#
-!
-~
-~
-/ see json pointers ietf rfc 6901
-^
-=
-:
-&gt;
-Hello Chris
-You have just won 10000 dollars!
-
-Well, 6000 dollars, after taxes.
-
-Shown.
-
-
- No person
-
-
-
- <b>resque</b> reviewers: avrel committers: joe william
-
- <b>hub</b> reviewers: avrel committers: jack greg
-
- <b>rip</b> reviewers: joe jack committers: greg
-
-
-
- Hi Jon!
-
-
-
-=====================================
-
-
- <b>resque</b> reviewers: avrel committers: joe william
-
- <b>hub</b> reviewers: avrel committers: jack greg
-
- <b>rip</b> reviewers: joe jack committers: greg
-
-=====================================
-
-ggggggggg
-----3.14159----
-jjjjjjjjj
-end
-
-#
-!
-~
-~
-/ see json pointers IETF RFC 6901
-^
-=
-:
-&gt;
diff --git a/src/templating/test6/test-custom-write.c b/src/templating/test6/test-custom-write.c
index cc50a47cb..4ba953a85 100644
--- a/src/templating/test6/test-custom-write.c
+++ b/src/templating/test6/test-custom-write.c
@@ -1,6 +1,5 @@
/*
Author: José Bollo <jobol@nonadev.net>
- Author: José Bollo <jose.bollo@iot.bzh>
https://gitlab.com/jobol/mustach
@@ -36,7 +35,7 @@ static char *readfile(const char *filename)
{
int f;
struct stat s;
- char *result;
+ char *result, *ptr;
size_t size, pos;
ssize_t rc;
@@ -80,7 +79,10 @@ static char *readfile(const char *filename)
pos += (size_t)rc;
if (pos > size) {
size = pos + BLOCKSIZE;
- result = realloc(result, size + 1);
+ ptr = realloc(result, size + 1);
+ if (!ptr)
+ free(result);
+ result = ptr;
}
}
} while(rc > 0);
@@ -132,7 +134,7 @@ int main(int ac, char **av)
mode = None;
else {
t = readfile(*av);
- s = umustach_json_c(t, o, uwrite, NULL);
+ s = mustach_json_c_write(t, 0, o, Mustach_With_AllExtensions, uwrite, NULL);
if (s != 0)
fprintf(stderr, "Template error %d\n", s);
free(t);
diff --git a/src/templating/test_mustach_jansson.c b/src/templating/test_mustach_jansson.c
index be3db67d2..beb155f6d 100644
--- a/src/templating/test_mustach_jansson.c
+++ b/src/templating/test_mustach_jansson.c
@@ -24,7 +24,7 @@
*/
#include "platform.h"
#include "mustach-jansson.h"
-
+#include <gnunet/gnunet_util_lib.h>
static void
assert_template (const char *template,
@@ -34,10 +34,12 @@ assert_template (const char *template,
char *r;
size_t sz;
- GNUNET_assert (0 == mustach_jansson (template,
- root,
- &r,
- &sz));
+ GNUNET_assert (0 == mustach_jansson_mem (template,
+ 0,
+ root,
+ Mustach_With_AllExtensions,
+ &r,
+ &sz));
GNUNET_assert (0 == strcmp (r,
expected));
GNUNET_free (r);
@@ -51,7 +53,6 @@ main (int argc,
json_t *root = json_object ();
json_t *arr = json_array ();
json_t *obj = json_object ();
- json_t *contract;
/* test 1 */
const char *t1 = "hello world";
const char *x1 = "hello world";
@@ -67,24 +68,15 @@ main (int argc,
/* test 5 */
const char *t5 = "hello {{# v3 }}{{ y }}/{{ x }}{{ z }}{{/ v3 }}";
const char *x5 = "hello quux/baz";
- /* test 6 */
- const char *t6 = "hello {{ v2!stringify }}";
- const char *x6 = "hello [\n \"foo\",\n \"bar\"\n]";
- /* test 7 */
- const char *t7 = "amount: {{ amt!amount_decimal }} {{ amt!amount_currency }}";
- const char *x7 = "amount: 123.00 EUR";
/* test 8 */
const char *t8 = "{{^ v4 }}fallback{{/ v4 }}";
const char *x8 = "fallback";
- /* contract test 8 (contract) */
- const char *tc = "summary: {{ summary!i18n }}";
- const char *xc_en = "summary: ENGLISH";
- const char *xc_de = "summary: DEUTSCH";
- const char *xc_fr = "summary: FRANCAISE";
-
(void) argc;
(void) argv;
+ GNUNET_log_setup ("test-mustach-jansson",
+ "INFO",
+ NULL);
GNUNET_assert (NULL != root);
GNUNET_assert (NULL != arr);
GNUNET_assert (NULL != obj);
@@ -122,44 +114,12 @@ main (int argc,
json_object_set_new (obj,
"y",
json_string ("quux")));
- contract = json_pack ("{ s:s, s:{s:s, s:s}}",
- "summary",
- "ENGLISH",
- "summary_i18n",
- "de",
- "DEUTSCH",
- "fr",
- "FRANCAISE");
- GNUNET_assert (NULL != contract);
-
assert_template (t1, root, x1);
assert_template (t2, root, x2);
assert_template (t3, root, x3);
assert_template (t4, root, x4);
assert_template (t5, root, x5);
- assert_template (t6, root, x6);
- assert_template (t7, root, x7);
assert_template (t8, root, x8);
- assert_template (tc, contract, xc_en);
-
- GNUNET_assert (0 ==
- json_object_set_new (contract,
- "$language",
- json_string ("de")));
- assert_template (tc, contract, xc_de);
-
- GNUNET_assert (0 ==
- json_object_set_new (contract,
- "$language",
- json_string ("fr")));
- assert_template (tc, contract, xc_fr);
-
- GNUNET_assert (0 ==
- json_object_set_new (contract,
- "$language",
- json_string ("it")));
- assert_template (tc, contract, xc_en);
json_decref (root);
- json_decref (contract);
return 0;
}