Merge pull request #3929 from laytan/fix-fmt-len-transfer-to-children

fmt: fix optional_len or use_nul_termination being used by both array and elems
This commit is contained in:
Jeroen van Rijn
2024-07-15 19:36:20 +02:00
committed by GitHub
2 changed files with 24 additions and 0 deletions
+16
View File
@@ -372,6 +372,22 @@ test_odin_value_export :: proc(t: ^testing.T) {
}
}
@(test)
leaking_struct_tag :: proc(t: ^testing.T) {
My_Struct :: struct {
names: [^]string `fmt:"v,name_count"`,
name_count: int,
}
name := "hello?"
foo := My_Struct {
names = &name,
name_count = 1,
}
check(t, "My_Struct{names = [\"hello?\"], name_count = 1}", "%v", foo)
}
@(private)
check :: proc(t: ^testing.T, exp: string, format: string, args: ..any, loc := #caller_location) {
got := fmt.tprintf(format, ..args)