summaryrefslogtreecommitdiffstats
path: root/libhandlebars-check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'libhandlebars-check.patch')
-rw-r--r--libhandlebars-check.patch996
1 files changed, 996 insertions, 0 deletions
diff --git a/libhandlebars-check.patch b/libhandlebars-check.patch
new file mode 100644
index 0000000..7780862
--- /dev/null
+++ b/libhandlebars-check.patch
@@ -0,0 +1,996 @@
+Adapted for 0.6.4 using upstream patch
+
+
+
+From e1b94ca3e4bfda19914230720e4f43a47114a850 Mon Sep 17 00:00:00 2001
+From: John Boehr <john@johnboehr.is>
+Date: Tue, 10 Dec 2019 21:54:57 -0800
+Subject: [PATCH] Fix issue with newer versions of libcheck
+
+---
+ tests/test_cache.c | 16 ++++++++
+ tests/test_opcode_printer.c | 28 +++++++++++---
+ tests/test_opcodes.c | 56 ++++++++++++++-------------
+ tests/test_string.c | 76 +++++++++++++++++++++++++++++++++++++
+ tests/test_token.c | 36 +++++++++++-------
+ tests/test_value.c | 4 ++
+ 6 files changed, 170 insertions(+), 46 deletions(-)
+
+diff -up ./tests/test_cache.c.newcheck ./tests/test_cache.c
+--- ./tests/test_cache.c.newcheck 2020-02-19 16:17:30.602476530 +0100
++++ ./tests/test_cache.c 2020-02-19 16:18:51.212075794 +0100
+@@ -210,35 +210,44 @@ static void execute_reset_test(struct ha
+ }
+
+ START_TEST(test_simple_cache_gc)
++{
+ struct handlebars_cache * cache = handlebars_cache_simple_ctor(context);
+ execute_gc_test(cache);
+ handlebars_cache_dtor(cache);
++}
+ END_TEST
+
+ START_TEST(test_simple_cache_reset)
++{
+ struct handlebars_cache * cache = handlebars_cache_simple_ctor(context);
+ execute_reset_test(cache);
+ handlebars_cache_dtor(cache);
++}
+ END_TEST
+
+ #ifdef HAVE_LIBLMDB
+ START_TEST(test_lmdb_cache_gc)
++{
+ char tmp[256];
+ snprintf(tmp, 256, "%s/%s", getenv("TMPDIR") ?: "/tmp", "handlebars-lmdb-cache-test.mdb");
+ struct handlebars_cache * cache = handlebars_cache_lmdb_ctor(context, tmp);
+ execute_gc_test(cache);
+ handlebars_cache_dtor(cache);
++}
+ END_TEST
+
+ START_TEST(test_lmdb_cache_reset)
++{
+ char tmp[256];
+ snprintf(tmp, 256, "%s/%s", getenv("TMPDIR") ?: "/tmp", "handlebars-lmdb-cache-test.mdb");
+ struct handlebars_cache * cache = handlebars_cache_lmdb_ctor(context, tmp);
+ execute_reset_test(cache);
+ handlebars_cache_dtor(cache);
++}
+ END_TEST
+ #else
+ START_TEST(test_lmdb_cache_error)
++{
+ jmp_buf buf;
+ char tmp[256];
+ snprintf(tmp, 256, "%s/%s", getenv("TMPDIR") ?: "/tmp", "handlebars-lmdb-cache-test.mdb");
+@@ -250,19 +259,24 @@ START_TEST(test_lmdb_cache_error)
+
+ struct handlebars_cache * cache = handlebars_cache_lmdb_ctor(context, tmp);
+ ck_assert(0);
++}
+ END_TEST
+ #endif
+
+ START_TEST(test_mmap_cache_gc)
++{
+ struct handlebars_cache * cache = handlebars_cache_mmap_ctor(context, 2097152, 2053);
+ execute_gc_test(cache);
+ handlebars_cache_dtor(cache);
++}
+ END_TEST
+
+ START_TEST(test_mmap_cache_reset)
++{
+ struct handlebars_cache * cache = handlebars_cache_mmap_ctor(context, 2097152, 2053);
+ execute_gc_test(cache);
+ handlebars_cache_dtor(cache);
++}
+ END_TEST
+
+ Suite * parser_suite(void)
+diff -up ./tests/test_opcode_printer.c.newcheck ./tests/test_opcode_printer.c
+--- ./tests/test_opcode_printer.c.newcheck 2017-07-18 03:21:21.000000000 +0200
++++ ./tests/test_opcode_printer.c 2020-02-19 16:17:30.602476530 +0100
+@@ -38,6 +38,7 @@
+
+
+ START_TEST(test_operand_print_append_null)
++{
+ struct handlebars_operand op;
+ struct handlebars_string * string;
+ handlebars_operand_set_null(&op);
+@@ -45,9 +46,11 @@ START_TEST(test_operand_print_append_nul
+ ck_assert_ptr_ne(NULL, string);
+ ck_assert_str_eq("[NULL]", string->val);
+ handlebars_talloc_free(string);
++}
+ END_TEST
+
+ START_TEST(test_operand_print_append_boolean)
++{
+ struct handlebars_operand op;
+ struct handlebars_string * string;
+ handlebars_operand_set_boolval(&op, 1);
+@@ -55,9 +58,11 @@ START_TEST(test_operand_print_append_boo
+ ck_assert_ptr_ne(NULL, string);
+ ck_assert_str_eq("[BOOLEAN:1]", string->val);
+ handlebars_talloc_free(string);
++}
+ END_TEST
+
+ START_TEST(test_operand_print_append_long)
++{
+ struct handlebars_operand op;
+ struct handlebars_string * string;
+ handlebars_operand_set_longval(&op, 2358);
+@@ -65,9 +70,11 @@ START_TEST(test_operand_print_append_lon
+ ck_assert_ptr_ne(NULL, string);
+ ck_assert_str_eq("[LONG:2358]", string->val);
+ handlebars_talloc_free(string);
++}
+ END_TEST
+
+ START_TEST(test_operand_print_append_string)
++{
+ struct handlebars_operand op;
+ struct handlebars_string * string;
+ struct handlebars_opcode * opcode = handlebars_opcode_ctor(context, handlebars_opcode_type_nil);
+@@ -76,10 +83,13 @@ START_TEST(test_operand_print_append_str
+ ck_assert_ptr_ne(NULL, string);
+ ck_assert_str_eq("[STRING:baz]", string->val);
+ handlebars_talloc_free(string);
++}
+ END_TEST
+
+ START_TEST(test_operand_print_append_array)
++{
+ // @todo
++}
+ END_TEST
+
+ START_TEST(test_opcode_print_1)
+@@ -94,6 +104,7 @@ START_TEST(test_opcode_print_1)
+ END_TEST
+
+ START_TEST(test_opcode_print_2)
++{
+ struct handlebars_opcode * opcode = handlebars_opcode_ctor(context, handlebars_opcode_type_get_context);
+ char * expected = "getContext[LONG:2358]";
+ struct handlebars_string * string;
+@@ -102,9 +113,11 @@ START_TEST(test_opcode_print_2)
+ ck_assert_str_eq(expected, string->val);
+ handlebars_talloc_free(opcode);
+ handlebars_talloc_free(string);
++}
+ END_TEST
+
+ START_TEST(test_opcode_print_3)
++{
+ struct handlebars_opcode * opcode = handlebars_opcode_ctor(context, handlebars_opcode_type_invoke_helper);
+ char * expected = "invokeHelper[LONG:123][STRING:baz][LONG:456]";
+ struct handlebars_string * string;
+@@ -117,9 +130,11 @@ START_TEST(test_opcode_print_3)
+ ck_assert_str_eq(expected, string->val);
+ handlebars_talloc_free(opcode);
+ handlebars_talloc_free(string);
++}
+ END_TEST
+
+ START_TEST(test_opcode_print_4)
++{
+ struct handlebars_opcode * opcode = handlebars_opcode_ctor(context, handlebars_opcode_type_lookup_on_context);
+ char * expected = "lookupOnContext[LONG:123][STRING:baz][LONG:456][STRING:bat]";
+ struct handlebars_string * string;
+@@ -133,13 +148,14 @@ START_TEST(test_opcode_print_4)
+ ck_assert_str_eq(expected, string->val);
+ handlebars_talloc_free(opcode);
+ handlebars_talloc_free(string);
++}
+ END_TEST
+
+
+ Suite * parser_suite(void)
+ {
+ Suite * s = suite_create("Opcode Printer");
+-
++
+ REGISTER_TEST_FIXTURE(s, test_operand_print_append_null, "Operand Print Append (null)");
+ REGISTER_TEST_FIXTURE(s, test_operand_print_append_boolean, "Operand Print Append (boolean)");
+ REGISTER_TEST_FIXTURE(s, test_operand_print_append_long, "Operand Print Append (long)");
+@@ -149,7 +165,7 @@ Suite * parser_suite(void)
+ REGISTER_TEST_FIXTURE(s, test_opcode_print_2, "Opcode Print (2)");
+ REGISTER_TEST_FIXTURE(s, test_opcode_print_3, "Opcode Print (3)");
+ REGISTER_TEST_FIXTURE(s, test_opcode_print_4, "Opcode Print (4)");
+-
++
+ return s;
+ }
+
+@@ -160,13 +176,13 @@ int main(void)
+ int error;
+
+ talloc_set_log_stderr();
+-
++
+ // Check if memdebug enabled
+ memdebug = getenv("MEMDEBUG") ? atoi(getenv("MEMDEBUG")) : 0;
+ if( memdebug ) {
+ talloc_enable_leak_report_full();
+ }
+-
++
+ // Set up test suite
+ Suite * s = parser_suite();
+ SRunner * sr = srunner_create(s);
+@@ -177,12 +193,12 @@ int main(void)
+ number_failed = srunner_ntests_failed(sr);
+ srunner_free(sr);
+ error = (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+-
++
+ // Generate report for memdebug
+ if( memdebug ) {
+ talloc_report_full(NULL, stderr);
+ }
+-
++
+ // Return
+ return error;
+ }
+diff -up ./tests/test_opcodes.c.newcheck ./tests/test_opcodes.c
+--- ./tests/test_opcodes.c.newcheck 2017-07-18 03:21:21.000000000 +0200
++++ ./tests/test_opcodes.c 2020-02-19 16:17:30.602476530 +0100
+@@ -37,10 +37,10 @@
+ START_TEST(test_opcode_ctor)
+ {
+ struct handlebars_opcode * opcode = handlebars_opcode_ctor(context, handlebars_opcode_type_append);
+-
++
+ ck_assert_ptr_ne(NULL, opcode);
+ ck_assert_int_eq(handlebars_opcode_type_append, opcode->type);
+-
++
+ handlebars_talloc_free(opcode);
+ }
+ END_TEST
+@@ -76,7 +76,7 @@ START_TEST(test_opcode_readable_type)
+ const char * actual = handlebars_opcode_readable_type(_RTYPE_MK(type)); \
+ ck_assert_str_eq(expected, actual); \
+ } while(0)
+-
++
+ _RTYPE_TEST(nil, nil);
+ _RTYPE_TEST(ambiguous_block_value, ambiguousBlockValue);
+ _RTYPE_TEST(append, append);
+@@ -86,33 +86,33 @@ START_TEST(test_opcode_readable_type)
+ _RTYPE_TEST(push_context, pushContext);
+ _RTYPE_TEST(push_hash, pushHash);
+ _RTYPE_TEST(resolve_possible_lambda, resolvePossibleLambda);
+-
++
+ _RTYPE_TEST(get_context, getContext);
+ _RTYPE_TEST(push_program, pushProgram);
+-
++
+ _RTYPE_TEST(append_content, appendContent);
+ _RTYPE_TEST(assign_to_hash, assignToHash);
+ _RTYPE_TEST(block_value, blockValue);
+ _RTYPE_TEST(push, push);
+ _RTYPE_TEST(push_literal, pushLiteral);
+ _RTYPE_TEST(push_string, pushString);
+-
++
+ _RTYPE_TEST(invoke_partial, invokePartial);
+ _RTYPE_TEST(push_id, pushId);
+ _RTYPE_TEST(push_string_param, pushStringParam);
+-
++
+ _RTYPE_TEST(invoke_ambiguous, invokeAmbiguous);
+-
++
+ _RTYPE_TEST(invoke_known_helper, invokeKnownHelper);
+-
++
+ _RTYPE_TEST(invoke_helper, invokeHelper);
+-
++
+ _RTYPE_TEST(lookup_on_context, lookupOnContext);
+-
++
+ _RTYPE_TEST(lookup_data, lookupData);
+-
++
+ _RTYPE_TEST(invalid, invalid);
+-
++
+ ck_assert_str_eq("invalid", handlebars_opcode_readable_type(13434534));
+ }
+ END_TEST
+@@ -120,7 +120,7 @@ END_TEST
+ START_TEST(test_operand_set_null)
+ {
+ struct handlebars_operand op;
+-
++
+ handlebars_operand_set_null(&op);
+ ck_assert_int_eq(handlebars_operand_type_null, op.type);
+ ck_assert_int_eq(0, op.data.boolval);
+@@ -132,7 +132,7 @@ END_TEST
+ START_TEST(test_operand_set_boolval)
+ {
+ struct handlebars_operand op;
+-
++
+ handlebars_operand_set_boolval(&op, 1);
+ ck_assert_int_eq(handlebars_operand_type_boolean, op.type);
+ ck_assert_int_eq(1, op.data.boolval);
+@@ -142,11 +142,11 @@ END_TEST
+ START_TEST(test_operand_set_longval)
+ {
+ struct handlebars_operand op;
+-
++
+ handlebars_operand_set_longval(&op, 12);
+ ck_assert_int_eq(handlebars_operand_type_long, op.type);
+ ck_assert_int_eq(12, op.data.longval);
+-
++
+ handlebars_operand_set_longval(&op, -65);
+ ck_assert_int_eq(handlebars_operand_type_long, op.type);
+ ck_assert_int_eq(-65, op.data.longval);
+@@ -158,7 +158,7 @@ START_TEST(test_operand_set_stringval)
+ struct handlebars_operand op;
+ struct handlebars_opcode * opcode = handlebars_opcode_ctor(context, handlebars_opcode_type_nil);
+ struct handlebars_string * string = handlebars_string_ctor(context, HBS_STRL("bar"));
+-
++
+ handlebars_operand_set_stringval(context, opcode, &op, string);
+
+ ck_assert_int_eq(handlebars_operand_type_string, op.type);
+@@ -190,6 +190,7 @@ END_TEST
+ */
+
+ START_TEST(test_operand_set_arrayval)
++{
+ struct handlebars_operand op;
+ struct handlebars_opcode * opcode = handlebars_opcode_ctor(context, handlebars_opcode_type_nil);
+ const char * strs[] = {
+@@ -208,9 +209,11 @@ START_TEST(test_operand_set_arrayval)
+ for( ptr1 = strs, ptr2 = op.data.array.array; *ptr1 /*|| *ptr2*/; ptr1++, ptr2++ ) {
+ ck_assert_str_eq(*ptr1, ptr2->string->val);
+ }
++}
+ END_TEST
+
+ START_TEST(test_operand_set_arrayval_string)
++{
+ struct handlebars_string * strings[5];
+ struct handlebars_opcode * opcode = handlebars_opcode_ctor(context, handlebars_opcode_type_invalid);
+
+@@ -232,16 +235,17 @@ START_TEST(test_operand_set_arrayval_str
+ for( ptr1 = strings, ptr2 = opcode->op1.data.array.array; *ptr1 /* || *ptr2*/; ptr1++, ptr2++ ) {
+ ck_assert_str_eq((*ptr1)->val, ptr2->string->val);
+ }
++}
+ END_TEST
+
+ Suite * parser_suite(void)
+ {
+ Suite * s = suite_create("Opcodes");
+-
++
+ REGISTER_TEST_FIXTURE(s, test_opcode_ctor, "Constructor");
+ REGISTER_TEST_FIXTURE(s, test_opcode_ctor_failed_alloc, "Constructor (failed alloc)");
+ REGISTER_TEST_FIXTURE(s, test_opcode_readable_type, "Readable Type");
+-
++
+ REGISTER_TEST_FIXTURE(s, test_operand_set_null, "Set operand null");
+ REGISTER_TEST_FIXTURE(s, test_operand_set_boolval, "Set operand boolval");
+ REGISTER_TEST_FIXTURE(s, test_operand_set_longval, "Set operand longval");
+@@ -249,8 +253,8 @@ Suite * parser_suite(void)
+ //REGISTER_TEST_FIXTURE(s, test_operand_set_stringval_failed_alloc, "Set operand stringval (failed alloc)");
+ REGISTER_TEST_FIXTURE(s, test_operand_set_arrayval, "Set operand arrayval");
+ REGISTER_TEST_FIXTURE(s, test_operand_set_arrayval_string, "operand_set_arrayval_string");
+-
+-
++
++
+ return s;
+ }
+
+@@ -261,13 +265,13 @@ int main(void)
+ int error;
+
+ talloc_set_log_stderr();
+-
++
+ // Check if memdebug enabled
+ memdebug = getenv("MEMDEBUG") ? atoi(getenv("MEMDEBUG")) : 0;
+ if( memdebug ) {
+ talloc_enable_leak_report_full();
+ }
+-
++
+ // Set up test suite
+ Suite * s = parser_suite();
+ SRunner * sr = srunner_create(s);
+@@ -278,12 +282,12 @@ int main(void)
+ number_failed = srunner_ntests_failed(sr);
+ srunner_free(sr);
+ error = (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+-
++
+ // Generate report for memdebug
+ if( memdebug ) {
+ talloc_report_full(NULL, stderr);
+ }
+-
++
+ // Return
+ return error;
+ }
+diff -up ./tests/test_string.c.newcheck ./tests/test_string.c
+--- ./tests/test_string.c.newcheck 2017-07-18 03:21:21.000000000 +0200
++++ ./tests/test_string.c 2020-02-19 16:17:30.602476530 +0100
+@@ -33,167 +33,210 @@
+
+
+ START_TEST(test_handlebars_string_hash)
++{
+ #if ULONG_MAX <= 4294967295
+ ck_assert_uint_eq(3127933309, handlebars_string_hash(HBS_STRL("foobar\xFF")));
+ #else
+ ck_assert_uint_eq(229466050689405, handlebars_string_hash(HBS_STRL("foobar\xFF")));
+ #endif
++}
+ END_TEST
+
+ START_TEST(test_handlebars_strnstr_1)
++{
+ const char string[] = "";
+ const char * res = handlebars_strnstr(HBS_STRL(string), HBS_STRL(""));
+ ck_assert_ptr_eq(res, NULL);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_strnstr_2)
++{
+ const char string[] = "abcdefgh";
+ const char * res = handlebars_strnstr(HBS_STRL(string), HBS_STRL("def"));
+ ck_assert_ptr_eq(res, string + 3);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_strnstr_3)
++{
+ const char string[] = "a\0bcdefgh";
+ const char * res = handlebars_strnstr(HBS_STRL(string), HBS_STRL("def"));
+ ck_assert_ptr_eq(res, string + 4);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_strnstr_4)
++{
+ const char string[] = "abcdefgh";
+ const char * res = handlebars_strnstr(string, 4, HBS_STRL("fgh"));
+ ck_assert_ptr_eq(res, NULL);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_strnstr_5)
++{
+ const char string[] = "[foo\\\\]";
+ const char * res = handlebars_strnstr(HBS_STRL(string), HBS_STRL("\\]"));
+ ck_assert_ptr_eq(res, string + 5);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_reduce_1)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("abcdef"));
+ input = handlebars_str_reduce(input, HBS_STRL("bcd"), HBS_STRL("qq"));
+ ck_assert_str_eq("aqqef", input->val);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_reduce_2)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL(""));
+ input = handlebars_str_reduce(input, HBS_STRL("a"), HBS_STRL(""));
+ ck_assert_str_eq("", input->val);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_reduce_3)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("QQQ"));
+ input = handlebars_str_reduce(input, HBS_STRL("Q"), HBS_STRL("W"));
+ ck_assert_str_eq("WWW", input->val);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_addcslashes_1)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL(""));
+ struct handlebars_string * actual = handlebars_string_addcslashes(context, input, HBS_STRL(""));
+ ck_assert_str_eq("", actual->val);
+ ck_assert_ptr_ne(input, actual);
+ handlebars_talloc_free(input);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_addcslashes_2)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("\ttest\rlines\n"));
+ struct handlebars_string * actual = handlebars_string_addcslashes(context, input, HBS_STRL("\r\n\t"));
+ ck_assert_str_eq("\\ttest\\rlines\\n", actual->val);
+ ck_assert_ptr_ne(input, actual);
+ handlebars_talloc_free(input);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_addcslashes_3)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("amazing biscuit circus"));
+ struct handlebars_string * actual = handlebars_string_addcslashes(context, input, HBS_STRL("abc"));
+ ck_assert_str_eq("\\am\\azing \\bis\\cuit \\cir\\cus", actual->val);
+ ck_assert_ptr_ne(input, actual);
+ handlebars_talloc_free(input);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_addcslashes_4)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("kaboemkara!"));
+ struct handlebars_string * actual = handlebars_string_addcslashes(context, input, HBS_STRL(""));
+ ck_assert_str_eq("kaboemkara!", actual->val);
+ ck_assert_ptr_ne(input, actual);
+ handlebars_talloc_free(input);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_addcslashes_5)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("foobarbaz"));
+ struct handlebars_string * actual = handlebars_string_addcslashes(context, input, HBS_STRL("bar"));
+ ck_assert_str_eq("foo\\b\\a\\r\\b\\az", actual->val);
+ ck_assert_ptr_ne(input, actual);
+ handlebars_talloc_free(input);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_addcslashes_6)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("\a\v\b\f\x3"));
+ struct handlebars_string * actual = handlebars_string_addcslashes(context, input, HBS_STRL("\a\v\b\f\x3"));
+ ck_assert_str_eq("\\a\\v\\b\\f\\003", actual->val);
+ ck_assert_ptr_ne(input, actual);
+ handlebars_talloc_free(input);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_stripcslashes_1)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("\\n\\r"));
+ struct handlebars_string * actual = handlebars_string_stripcslashes(input);
+ ck_assert_str_eq("\n\r", actual->val);
+ ck_assert_ptr_eq(input, actual);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_stripcslashes_2)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("\\065\\x64"));
+ struct handlebars_string * actual = handlebars_string_stripcslashes(input);
+ ck_assert_str_eq("5d", actual->val);
+ ck_assert_ptr_eq(input, actual);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_stripcslashes_3)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL(""));
+ struct handlebars_string * actual = handlebars_string_stripcslashes(input);
+ ck_assert_str_eq("", actual->val);
+ ck_assert_ptr_eq(input, actual);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_stripcslashes_4)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("\\{"));
+ struct handlebars_string * actual = handlebars_string_stripcslashes(input);
+ ck_assert_str_eq("{", actual->val);
+ ck_assert_ptr_eq(input, actual);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_stripcslashes_5)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("\\a\\t\\v\\b\\f\\\\"));
+ struct handlebars_string * actual = handlebars_string_stripcslashes(input);
+ ck_assert_str_eq("\a\t\v\b\f\\", actual->val);
+ ck_assert_ptr_eq(input, actual);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_stripcslashes_6)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("\\x3"));
+ struct handlebars_string * actual = handlebars_string_stripcslashes(input);
+ ck_assert_str_eq("\x3", actual->val);
+ ck_assert_ptr_eq(input, actual);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_stripcslashes_7)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("\\0test"));
+ struct handlebars_string * actual = handlebars_string_stripcslashes(input);
+ ck_assert_str_eq("", actual->val);
+@@ -203,67 +246,87 @@ START_TEST(test_handlebars_string_stripc
+ ck_assert_int_eq(0, actual->val[5]);
+ ck_assert_ptr_eq(input, actual);
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_asprintf)
++{
+ struct handlebars_string * actual = handlebars_string_asprintf(context, "|%d|%c|%s|", 148, 56, "1814");
+ ck_assert_str_eq(actual->val, "|148|8|1814|");
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_asprintf_append)
++{
+ struct handlebars_string * input = handlebars_string_ctor(context, HBS_STRL("PREFIX"));
+ input = handlebars_string_asprintf_append(context, input, "|%d|%c|%s|", 148, 56, "1814");
+ ck_assert_str_eq(input->val, "PREFIX|148|8|1814|");
+ handlebars_talloc_free(input);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_htmlspecialchars_1)
++{
+ struct handlebars_string * actual = handlebars_string_htmlspecialchars(context, HBS_STRL("&"));
+ ck_assert_str_eq("&amp;", actual->val);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_htmlspecialchars_2)
++{
+ struct handlebars_string * actual = handlebars_string_htmlspecialchars(context, HBS_STRL("<"));
+ ck_assert_str_eq("&lt;", actual->val);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_htmlspecialchars_3)
++{
+ struct handlebars_string * actual = handlebars_string_htmlspecialchars(context, HBS_STRL(">"));
+ ck_assert_str_eq("&gt;", actual->val);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_htmlspecialchars_4)
++{
+ struct handlebars_string * actual = handlebars_string_htmlspecialchars(context, HBS_STRL("'"));
+ ck_assert_str_eq("&#x27;", actual->val);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_htmlspecialchars_5)
++{
+ struct handlebars_string * actual = handlebars_string_htmlspecialchars(context, HBS_STRL("\""));
+ ck_assert_str_eq("&quot;", actual->val);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_htmlspecialchars_6)
++{
+ struct handlebars_string * actual = handlebars_string_htmlspecialchars(context, HBS_STRL("a&b<c>d\'e\"f"));
+ ck_assert_str_eq("a&amp;b&lt;c&gt;d&#x27;e&quot;f", actual->val);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_implode_1)
++{
+ struct handlebars_string ** parts = handlebars_talloc_array(context, struct handlebars_string *, 1);
+ parts[0] = NULL;
+ struct handlebars_string * actual = handlebars_string_implode(context, HBS_STRL("!!!"), parts);
+ ck_assert_str_eq(actual->val, "");
+ handlebars_talloc_free(parts);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_implode_2)
++{
+ struct handlebars_string ** parts = handlebars_talloc_array(context, struct handlebars_string *, 3);
+ parts[0] = handlebars_string_ctor(context, HBS_STRL("one"));
+ parts[1] = handlebars_string_ctor(context, HBS_STRL("two"));
+@@ -272,54 +335,67 @@ START_TEST(test_handlebars_string_implod
+ ck_assert_str_eq(actual->val, "one!two");
+ handlebars_talloc_free(parts);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_ltrim_1)
++{
+ struct handlebars_string * in = handlebars_string_ctor(context, HBS_STRL(" \n \r test "));
+ struct handlebars_string * ret = handlebars_string_ltrim(in, HBS_STRL(" \t\r\n"));
+ ck_assert_str_eq(ret->val, "test ");
+ ck_assert_ptr_eq(in, ret);
+ handlebars_talloc_free(in);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_ltrim_2)
++{
+ struct handlebars_string * in = handlebars_string_ctor(context, HBS_STRL("\n "));
+ struct handlebars_string * ret = handlebars_string_ltrim(in, HBS_STRL(" \t"));
+ ck_assert_str_eq(ret->val, "\n ");
+ ck_assert_ptr_eq(in, ret);
+ handlebars_talloc_free(in);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_ltrim_3)
++{
+ struct handlebars_string * in = handlebars_string_ctor(context, HBS_STRL(""));
+ struct handlebars_string * ret = handlebars_string_ltrim(in, HBS_STRL(""));
+ ck_assert_str_eq(ret->val, "");
+ ck_assert_ptr_eq(in, ret);
+ handlebars_talloc_free(in);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_rtrim_1)
++{
+ struct handlebars_string * in = handlebars_string_ctor(context, HBS_STRL("test \n \r "));
+ struct handlebars_string * ret = handlebars_string_rtrim(in, HBS_STRL(" \t\r\n"));
+ ck_assert_str_eq(ret->val, "test");
+ ck_assert_ptr_eq(in, ret);
+ handlebars_talloc_free(in);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_rtrim_2)
++{
+ struct handlebars_string * in = handlebars_string_ctor(context, HBS_STRL("\n"));
+ struct handlebars_string * ret = handlebars_string_rtrim(in, HBS_STRL(" \v\t\r\n"));
+ ck_assert_str_eq(ret->val, "");
+ ck_assert_ptr_eq(in, ret);
+ handlebars_talloc_free(in);
++}
+ END_TEST
+
+ START_TEST(test_handlebars_string_rtrim_3)
++{
+ struct handlebars_string * in = handlebars_string_ctor(context, HBS_STRL(""));
+ struct handlebars_string * ret = handlebars_string_rtrim(in, HBS_STRL(""));
+ ck_assert_str_eq(ret->val, "");
+ ck_assert_ptr_eq(in, ret);
+ handlebars_talloc_free(in);
++}
+ END_TEST
+
+ Suite * parser_suite(void)
+diff -up ./tests/test_token.c.newcheck ./tests/test_token.c
+--- ./tests/test_token.c.newcheck 2017-07-18 03:21:21.000000000 +0200
++++ ./tests/test_token.c 2020-02-19 16:17:30.603476525 +0100
+@@ -38,13 +38,13 @@ START_TEST(test_token_ctor)
+ {
+ struct handlebars_string * string = handlebars_string_ctor(context, HBS_STRL("{{"));
+ struct handlebars_token * token = handlebars_token_ctor(HBSCTX(parser), OPEN, string);
+-
++
+ ck_assert_ptr_ne(NULL, token);
+ ck_assert_ptr_ne(NULL, token->string);
+ ck_assert_int_eq(OPEN, token->token);
+ ck_assert_str_eq(token->string->val, "{{");
+ ck_assert_uint_eq(sizeof("{{") - 1, token->string->len);
+-
++
+ handlebars_token_dtor(token);
+ }
+ END_TEST
+@@ -85,9 +85,9 @@ START_TEST(test_token_get_type)
+ {
+ struct handlebars_string * string = handlebars_string_ctor(context, HBS_STRL("{{"));
+ struct handlebars_token * token = handlebars_token_ctor(context, OPEN, string);
+-
++
+ ck_assert_int_eq(OPEN, handlebars_token_get_type(token));
+-
++
+ handlebars_token_dtor(token);
+ }
+ END_TEST
+@@ -99,7 +99,7 @@ START_TEST(test_token_get_text)
+
+ ck_assert_str_eq("{{", handlebars_token_get_text(token)->val);
+ ck_assert_uint_eq(sizeof("{{") - 1, handlebars_token_get_text(token)->len);
+-
++
+ handlebars_token_dtor(token);
+ }
+ END_TEST
+@@ -113,7 +113,7 @@ START_TEST(test_token_readable_type)
+ const char * actual = handlebars_token_readable_type(str); \
+ ck_assert_str_eq(expected, actual); \
+ } while(0)
+-
++
+ _RTYPE_TEST(BOOLEAN);
+ _RTYPE_TEST(CLOSE);
+ _RTYPE_TEST(CLOSE_RAW_BLOCK);
+@@ -140,7 +140,7 @@ START_TEST(test_token_readable_type)
+ _RTYPE_TEST(SEP);
+ _RTYPE_TEST(STRING);
+ ck_assert_str_eq("UNKNOWN", handlebars_token_readable_type(-1));
+-
++
+ // Added in v3
+ _RTYPE_TEST(CLOSE_BLOCK_PARAMS);
+ _RTYPE_TEST(OPEN_BLOCK_PARAMS);
+@@ -163,7 +163,7 @@ START_TEST(test_token_reverse_readable_t
+ int actual = handlebars_token_reverse_readable_type(actual_str); \
+ ck_assert_int_eq(expected, actual); \
+ } while(0)
+-
++
+ _RTYPE_REV_TEST(BOOLEAN);
+ _RTYPE_REV_TEST(CLOSE);
+ _RTYPE_REV_TEST(CLOSE_RAW_BLOCK);
+@@ -190,7 +190,7 @@ START_TEST(test_token_reverse_readable_t
+ _RTYPE_REV_TEST(SEP);
+ _RTYPE_REV_TEST(STRING);
+ ck_assert_int_eq(-1, handlebars_token_reverse_readable_type("UNKNOWN"));
+-
++
+ // Added in v3
+ _RTYPE_REV_TEST(CLOSE_BLOCK_PARAMS);
+ _RTYPE_REV_TEST(OPEN_BLOCK_PARAMS);
+@@ -204,33 +204,40 @@ START_TEST(test_token_reverse_readable_t
+ END_TEST
+
+ START_TEST(test_token_print)
++{
+ struct handlebars_string * string = handlebars_string_ctor(context, HBS_STRL("{{"));
+ struct handlebars_token * tok = handlebars_token_ctor(context, OPEN, string);
+ struct handlebars_string * actual = handlebars_token_print(context, tok, 0);
+ ck_assert_str_eq("OPEN [{{] ", actual->val);
+ handlebars_talloc_free(tok);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_token_print2)
++{
+ struct handlebars_string * string = handlebars_string_ctor(context, HBS_STRL("this\nis\ra\ttest"));
+ struct handlebars_token * tok = handlebars_token_ctor(context, CONTENT, string);
+ struct handlebars_string * actual = handlebars_token_print(context, tok, 0);
+ ck_assert_str_eq("CONTENT [this\\nis\\ra\\ttest] ", actual->val);
+ handlebars_talloc_free(tok);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_token_print3)
++{
+ struct handlebars_string * string = handlebars_string_ctor(context, HBS_STRL("this\nis\ra\ttest"));
+ struct handlebars_token * tok = handlebars_token_ctor(context, CONTENT, string);
+ struct handlebars_string * actual = handlebars_token_print(context, tok, handlebars_token_print_flag_newlines);
+ ck_assert_str_eq("CONTENT [this\\nis\\ra\\ttest]\n", actual->val);
+ handlebars_talloc_free(tok);
+ handlebars_talloc_free(actual);
++}
+ END_TEST
+
+ START_TEST(test_token_print_failed_alloc)
++{
+ #if HANDLEBARS_MEMORY
+ struct handlebars_string * string = handlebars_string_ctor(context, HBS_STRL("tok1"));
+ struct handlebars_token * tok = handlebars_token_ctor(context, CONTENT, string);
+@@ -251,12 +258,13 @@ START_TEST(test_token_print_failed_alloc
+ #else
+ fprintf(stderr, "Skipped, memory testing functions are disabled\n");
+ #endif
++}
+ END_TEST
+
+ Suite * parser_suite(void)
+ {
+ Suite * s = suite_create("Token");
+-
++
+ REGISTER_TEST_FIXTURE(s, test_token_ctor, "Constructor");
+ REGISTER_TEST_FIXTURE(s, test_token_ctor_failed_alloc, "Constructor (failed alloc)");
+ REGISTER_TEST_FIXTURE(s, test_token_dtor, "Destructor");
+@@ -279,13 +287,13 @@ int main(void)
+ int error;
+
+ talloc_set_log_stderr();
+-
++
+ // Check if memdebug enabled
+ memdebug = getenv("MEMDEBUG") ? atoi(getenv("MEMDEBUG")) : 0;
+ if( memdebug ) {
+ talloc_enable_leak_report_full();
+ }
+-
++
+ // Set up test suite
+ Suite * s = parser_suite();
+ SRunner * sr = srunner_create(s);
+@@ -296,12 +304,12 @@ int main(void)
+ number_failed = srunner_ntests_failed(sr);
+ srunner_free(sr);
+ error = (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+-
++
+ // Generate report for memdebug
+ if( memdebug ) {
+ talloc_report_full(NULL, stderr);
+ }
+-
++
+ // Return
+ return error;
+ }
+diff -up ./tests/test_value.c.newcheck ./tests/test_value.c
+--- ./tests/test_value.c.newcheck 2017-07-18 03:21:21.000000000 +0200
++++ ./tests/test_value.c 2020-02-19 16:17:30.603476525 +0100
+@@ -438,6 +438,7 @@ START_TEST(test_convert)
+ END_TEST
+
+ START_TEST(test_json_parse_error)
++{
+ jmp_buf buf;
+
+ if( handlebars_setjmp_ex(context, &buf) ) {
+@@ -450,9 +451,11 @@ START_TEST(test_json_parse_error)
+
+ handlebars_value_from_json_string(context, "{\"key\":1");
+ ck_assert_msg(0, "Parse error should have longjmp'd");
++}
+ END_TEST
+
+ START_TEST(test_yaml_parse_error)
++{
+ jmp_buf buf;
+
+ if( handlebars_setjmp_ex(context, &buf) ) {
+@@ -465,6 +468,7 @@ START_TEST(test_yaml_parse_error)
+
+ handlebars_value_from_yaml_string(context, "---\n'");
+ ck_assert_msg(0, "Parse error should have longjmp'd");
++}
+ END_TEST
+
+ Suite * parser_suite(void)