| ... | ... | @@ -431,7 +431,7 @@ pub fn formatType( |
| 431 | 431 | }, |
| 432 | 432 | else => return format(context, Errors, output, "{}@{x}", .{ @typeName(T.Child), @ptrToInt(value) }), |
| 433 | 433 | }, |
| 434 | | .Many => { |
| 434 | .Many, .C => { |
| 435 | 435 | if (ptr_info.child == u8) { |
| 436 | 436 | if (fmt.len > 0 and fmt[0] == 's') { |
| 437 | 437 | const len = mem.len(u8, value); |
| ... | ... | @@ -449,9 +449,6 @@ pub fn formatType( |
| 449 | 449 | } |
| 450 | 450 | return format(context, Errors, output, "{}@{x}", .{ @typeName(ptr_info.child), @ptrToInt(value.ptr) }); |
| 451 | 451 | }, |
| 452 | | .C => { |
| 453 | | return format(context, Errors, output, "{}@{x}", .{ @typeName(T.Child), @ptrToInt(value) }); |
| 454 | | }, |
| 455 | 452 | }, |
| 456 | 453 | .Array => |info| { |
| 457 | 454 | const Slice = @Type(builtin.TypeInfo{ |
| ... | ... | @@ -1285,8 +1282,16 @@ test "pointer" { |
| 1285 | 1282 | } |
| 1286 | 1283 | |
| 1287 | 1284 | test "cstr" { |
| 1288 | | try testFmt("cstr: Test C\n", "cstr: {s}\n", .{"Test C"}); |
| 1289 | | try testFmt("cstr: Test C \n", "cstr: {s:10}\n", .{"Test C"}); |
| 1285 | try testFmt( |
| 1286 | "cstr: Test C\n", |
| 1287 | "cstr: {s}\n", |
| 1288 | .{@ptrCast([*c]const u8, "Test C")}, |
| 1289 | ); |
| 1290 | try testFmt( |
| 1291 | "cstr: Test C \n", |
| 1292 | "cstr: {s:10}\n", |
| 1293 | .{@ptrCast([*c]const u8, "Test C")}, |
| 1294 | ); |
| 1290 | 1295 | } |
| 1291 | 1296 | |
| 1292 | 1297 | test "filesize" { |