Add partial use of comments
This commit is contained in:
@@ -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) )
|
strings.write_string(&ret, section(r, data, skey[1:], true) )
|
||||||
case '&':
|
case '&':
|
||||||
strings.write_string(&ret, fmt.tprintf("%v",decode(data, skey[1:])) )
|
strings.write_string(&ret, fmt.tprintf("%v",decode(data, skey[1:])) )
|
||||||
|
case '!':
|
||||||
case:
|
case:
|
||||||
dec := decode(data, skey)
|
dec := decode(data, skey)
|
||||||
|
|
||||||
|
|||||||
13
testing.odin
13
testing.odin
@@ -25,12 +25,14 @@ test_struct :: struct {
|
|||||||
@(test)
|
@(test)
|
||||||
spec_test :: proc(t: ^testing.T){
|
spec_test :: proc(t: ^testing.T){
|
||||||
test_files := []string {
|
test_files := []string {
|
||||||
"./spec/specs/delimiters.json",
|
|
||||||
"./spec/specs/sections.json",
|
"./spec/specs/sections.json",
|
||||||
"./spec/specs/interpolation.json",
|
"./spec/specs/interpolation.json",
|
||||||
//"./spec/specs/inverted.json",
|
"./spec/specs/inverted.json",
|
||||||
//"./spec/specs/partials.json",
|
"./spec/specs/comments.json",
|
||||||
//"./spec/specs/comments.json",
|
/*
|
||||||
|
"./spec/specs/partials.json",
|
||||||
|
"./spec/specs/delimiters.json",
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in test_files {
|
for i in test_files {
|
||||||
@@ -45,13 +47,16 @@ spec_test :: proc(t: ^testing.T){
|
|||||||
|
|
||||||
json.unmarshal(data, &test, allocator=context.temp_allocator)
|
json.unmarshal(data, &test, allocator=context.temp_allocator)
|
||||||
|
|
||||||
|
failed := 0
|
||||||
for j in test.tests {
|
for j in test.tests {
|
||||||
ret := mustache(j.template, j.data)
|
ret := mustache(j.template, j.data)
|
||||||
defer delete(ret)
|
defer delete(ret)
|
||||||
|
|
||||||
if ret!=j.expected {
|
if ret!=j.expected {
|
||||||
log.warnf( "[%s:%s]: %s", i, j.name, j.desc )
|
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) )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user