diff options
| author | kristopher tate <kris.tate+github@gmail.com> | 2018-09-01 19:53:11 +0900 |
|---|---|---|
| committer | kristopher tate <kris.tate+github@gmail.com> | 2018-09-01 19:53:11 +0900 |
| commit | 7a633f472daba84b03dac18557f411c949f6b875 (patch) | |
| tree | 81e882f4e29f54eb81b542324199baa8dd05ce3e /std | |
| parent | 454b2362ee5e80dd1236535eaaec70d98e0d33ba (diff) | |
| download | zig-7a633f472daba84b03dac18557f411c949f6b875.tar.gz zig-7a633f472daba84b03dac18557f411c949f6b875.zip | |
std/fmt/index.zig: #1358: test bytes printed-out as hex;
Diffstat (limited to 'std')
| -rw-r--r-- | std/fmt/index.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/std/fmt/index.zig b/std/fmt/index.zig index a8ea5b4c5a..8e34bd43c4 100644 --- a/std/fmt/index.zig +++ b/std/fmt/index.zig @@ -1276,6 +1276,12 @@ test "fmt.format" { try testFmt("E.Two", "{}", inst); } + //print bytes as hex + { + const some_bytes = "\xCA\xFE\xBA\xBE"; + try testFmt("lowercase: cafebabe\n", "lowercase: {x}\n", some_bytes); + try testFmt("uppercase: CAFEBABE\n", "uppercase: {X}\n", some_bytes); + } } fn testFmt(expected: []const u8, comptime template: []const u8, args: ...) !void { |
