Go 25 var fmtTests = []struct { fmt string val any out string }{ {"%d", 12345, "12345"}, {"%v", 12345, "12345"}, {"%t", true, "true"}, // basic string {"%s", "abc", "abc"}, {"%q", "abc", `"abc"`}, {"%x", "abc", "616263"}, {"%x", "\xff\xf0\x0f\xff", "fff00fff"}, {"%X", "\xff\xf0\x0f\xff", "FFF00FFF"}, {"%x", "", ""}, {"% x", "", ""}, {"%#x", "", ""}, {"%# x", "", ""}, {"%x", "xyz", "78797a"}, {"%X", "xyz", "78797A"}, {"% x", "xyz", "78 79 7a"}, {"% X", "xyz", "78 79 7A"}, {"%#x", "xyz", "0x78797a"}, {"%#X", "xyz", "0X78797A"}, {"%# x", "xyz", "0x78 0x79 0x7a"}, {"%# X", "xyz", "0X78 0X79 0X7A"}, In Go, most tests are tabular These are tests for the “fmtˮ function {"%q", "abc", `"abc"`}, ^ format ^ input ^ expected