mirror of
https://github.com/gechandesu/structlog.git
synced 2026-05-13 11:46:45 +03:00
Add tests
This commit is contained in:
@@ -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'},
|
||||
]
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user