Add json encoding test + fix enum not being set on success.

This commit is contained in:
Daniel Gavin
2021-11-07 14:35:52 +01:00
parent 40eed29527
commit 5b074ceee5
4 changed files with 102 additions and 6 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ Marshal_Error :: union {
marshal :: proc(v: any, allocator := context.allocator) -> (data: []byte, err: Marshal_Error) {
b := strings.make_builder(allocator)
defer if err != nil || data == nil {
defer if err != .None {
strings.destroy_builder(&b)
}
@@ -27,7 +27,7 @@ marshal :: proc(v: any, allocator := context.allocator) -> (data: []byte, err: M
if len(b.buf) != 0 {
data = b.buf[:]
}
return
return data, .None
}
marshal_to_builder :: proc(b: ^strings.Builder, v: any) -> Marshal_Error {