| ... | ... | @@ -1276,6 +1276,12 @@ test "fmt.format" { |
| 1276 | 1276 | |
| 1277 | 1277 | try testFmt("E.Two", "{}", inst); |
| 1278 | 1278 | } |
| 1279 | //print bytes as hex |
| 1280 | { |
| 1281 | const some_bytes = "\xCA\xFE\xBA\xBE"; |
| 1282 | try testFmt("lowercase: cafebabe\n", "lowercase: {x}\n", some_bytes); |
| 1283 | try testFmt("uppercase: CAFEBABE\n", "uppercase: {X}\n", some_bytes); |
| 1284 | } |
| 1279 | 1285 | } |
| 1280 | 1286 | |
| 1281 | 1287 | fn testFmt(expected: []const u8, comptime template: []const u8, args: ...) !void { |