From 7124aeb94e1dede1cae62df719c869645705144b Mon Sep 17 00:00:00 2001 From: PedroEdiaz Date: Thu, 19 Jun 2025 22:01:03 -0600 Subject: [PATCH] Add partial use of comments --- mustache.odin | 1 + testing.odin | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mustache.odin b/mustache.odin index 02eef85..d47c663 100644 --- a/mustache.odin +++ b/mustache.odin @@ -76,6 +76,7 @@ mustache_reader :: proc(r: ^strings.Reader, data: any, section_key: string = "" strings.write_string(&ret, section(r, data, skey[1:], true) ) case '&': strings.write_string(&ret, fmt.tprintf("%v",decode(data, skey[1:])) ) + case '!': case: dec := decode(data, skey) diff --git a/testing.odin b/testing.odin index ccad94c..aedb403 100644 --- a/testing.odin +++ b/testing.odin @@ -25,12 +25,14 @@ test_struct :: struct { @(test) spec_test :: proc(t: ^testing.T){ test_files := []string { - "./spec/specs/delimiters.json", "./spec/specs/sections.json", "./spec/specs/interpolation.json", - //"./spec/specs/inverted.json", - //"./spec/specs/partials.json", - //"./spec/specs/comments.json", + "./spec/specs/inverted.json", + "./spec/specs/comments.json", + /* + "./spec/specs/partials.json", + "./spec/specs/delimiters.json", + */ } for i in test_files { @@ -45,13 +47,16 @@ spec_test :: proc(t: ^testing.T){ json.unmarshal(data, &test, allocator=context.temp_allocator) + failed := 0 for j in test.tests { ret := mustache(j.template, j.data) defer delete(ret) if ret!=j.expected { log.warnf( "[%s:%s]: %s", i, j.name, j.desc ) + failed += 1 } } + log.infof( "[%s] Passed: (%d/%d)", i, len(test.tests)-failed, len(test.tests) ) } }