summaryrefslogtreecommitdiffstats
path: root/contrib/libucl/tests/test_basic.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2014-07-18 06:58:01 +0000
committerbapt <bapt@FreeBSD.org>2014-07-18 06:58:01 +0000
commit2c479407e0afce2c05606d6d9c052858196fcea2 (patch)
tree96497f945ddb4dfe861d3b28b15907997f8d7e30 /contrib/libucl/tests/test_basic.c
parentd8612e9432a6a6bdeb374817db86445640e36cd4 (diff)
parentf900132171b58516e797b158ec4ae0f93501bed4 (diff)
downloadFreeBSD-src-2c479407e0afce2c05606d6d9c052858196fcea2.zip
FreeBSD-src-2c479407e0afce2c05606d6d9c052858196fcea2.tar.gz
Update libucl to the 2014-07-16 snapshot
This update brings streamlined ucl emitter support
Diffstat (limited to 'contrib/libucl/tests/test_basic.c')
-rw-r--r--contrib/libucl/tests/test_basic.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/contrib/libucl/tests/test_basic.c b/contrib/libucl/tests/test_basic.c
index 5a977aa..b4ed778 100644
--- a/contrib/libucl/tests/test_basic.c
+++ b/contrib/libucl/tests/test_basic.c
@@ -33,15 +33,21 @@ main (int argc, char **argv)
FILE *in, *out;
unsigned char *emitted = NULL;
const char *fname_in = NULL, *fname_out = NULL;
- int ret = 0, inlen, opt, json = 0;
+ int ret = 0, inlen, opt, json = 0, compact = 0, yaml = 0;
- while ((opt = getopt(argc, argv, "j")) != -1) {
+ while ((opt = getopt(argc, argv, "jcy")) != -1) {
switch (opt) {
case 'j':
json = 1;
break;
+ case 'c':
+ compact = 1;
+ break;
+ case 'y':
+ yaml = 1;
+ break;
default: /* '?' */
- fprintf (stderr, "Usage: %s [-j] [in] [out]\n",
+ fprintf (stderr, "Usage: %s [-jcy] [in] [out]\n",
argv[0]);
exit (EXIT_FAILURE);
}
@@ -104,7 +110,15 @@ main (int argc, char **argv)
}
obj = ucl_parser_get_object (parser);
if (json) {
- emitted = ucl_object_emit (obj, UCL_EMIT_JSON);
+ if (compact) {
+ emitted = ucl_object_emit (obj, UCL_EMIT_JSON_COMPACT);
+ }
+ else {
+ emitted = ucl_object_emit (obj, UCL_EMIT_JSON);
+ }
+ }
+ else if (yaml) {
+ emitted = ucl_object_emit (obj, UCL_EMIT_YAML);
}
else {
emitted = ucl_object_emit (obj, UCL_EMIT_CONFIG);
@@ -125,7 +139,15 @@ main (int argc, char **argv)
}
obj = ucl_parser_get_object (parser2);
if (json) {
- emitted = ucl_object_emit (obj, UCL_EMIT_JSON);
+ if (compact) {
+ emitted = ucl_object_emit (obj, UCL_EMIT_JSON_COMPACT);
+ }
+ else {
+ emitted = ucl_object_emit (obj, UCL_EMIT_JSON);
+ }
+ }
+ else if (yaml) {
+ emitted = ucl_object_emit (obj, UCL_EMIT_YAML);
}
else {
emitted = ucl_object_emit (obj, UCL_EMIT_CONFIG);
OpenPOWER on IntegriCloud