Add tests

This commit is contained in:
ge
2026-05-02 05:45:10 +03:00
parent b423c161af
commit 9d9c5a48b1
2 changed files with 36 additions and 0 deletions
+1
View File
@@ -431,6 +431,7 @@ pub fn (mut h TextHandler) handle(rec Record) ! {
} }
} }
} }
if i + 1 != rec.fields.len { if i + 1 != rec.fields.len {
if i in [0, 1] { if i in [0, 1] {
buf.write_byte(` `) buf.write_byte(` `)
+35
View File
@@ -0,0 +1,35 @@
import structlog
struct Simple {
foo int
bar string
}
fn test_struct_adapter() {
assert structlog.struct_adapter(Simple{10, 'fooo'}) == [
structlog.Field{'foo', 10},
structlog.Field{'bar', 'fooo'},
]
}
/* FIXME
enum SomeEnum {
one
two
three
}
struct WithEnum {
foo int
bar string
some_enum SomeEnum
}
fn test_struct_adapter_with_enum() {
assert structlog.struct_adapter(WithEnum{10, 'fooo', .two}) == [
structlog.Field{'foo', 10},
structlog.Field{'bar', 'fooo'},
structlog.Field{'some_enum', 'two'},
]
}
*/