| ... | @@ -679,6 +679,9 @@ pub fn formatType( | ... | @@ -679,6 +679,9 @@ pub fn formatType( |
| 679 | try writer.writeAll(" }"); | 679 | try writer.writeAll(" }"); |
| 680 | }, | 680 | }, |
| 681 | .vector => |info| { | 681 | .vector => |info| { |
| | 682 | if (max_depth == 0) { |
| | 683 | return writer.writeAll("{ ... }"); |
| | 684 | } |
| 682 | try writer.writeAll("{ "); | 685 | try writer.writeAll("{ "); |
| 683 | var i: usize = 0; | 686 | var i: usize = 0; |
| 684 | while (i < info.len) : (i += 1) { | 687 | while (i < info.len) : (i += 1) { |
| ... | @@ -2577,6 +2580,15 @@ test "formatType max_depth" { | ... | @@ -2577,6 +2580,15 @@ test "formatType max_depth" { |
| 2577 | fbs.reset(); | 2580 | fbs.reset(); |
| 2578 | try formatType(inst, "", FormatOptions{}, fbs.writer(), 3); | 2581 | try formatType(inst, "", FormatOptions{}, fbs.writer(), 3); |
| 2579 | try std.testing.expectEqualStrings("fmt.test.formatType max_depth.S{ .a = fmt.test.formatType max_depth.S{ .a = fmt.test.formatType max_depth.S{ .a = fmt.test.formatType max_depth.S{ ... }, .tu = fmt.test.formatType max_depth.TU{ ... }, .e = fmt.test.formatType max_depth.E.Two, .vec = (10.200,2.220) }, .tu = fmt.test.formatType max_depth.TU{ .ptr = fmt.test.formatType max_depth.TU{ ... } }, .e = fmt.test.formatType max_depth.E.Two, .vec = (10.200,2.220) }, .tu = fmt.test.formatType max_depth.TU{ .ptr = fmt.test.formatType max_depth.TU{ .ptr = fmt.test.formatType max_depth.TU{ ... } } }, .e = fmt.test.formatType max_depth.E.Two, .vec = (10.200,2.220) }", fbs.getWritten()); | 2582 | try std.testing.expectEqualStrings("fmt.test.formatType max_depth.S{ .a = fmt.test.formatType max_depth.S{ .a = fmt.test.formatType max_depth.S{ .a = fmt.test.formatType max_depth.S{ ... }, .tu = fmt.test.formatType max_depth.TU{ ... }, .e = fmt.test.formatType max_depth.E.Two, .vec = (10.200,2.220) }, .tu = fmt.test.formatType max_depth.TU{ .ptr = fmt.test.formatType max_depth.TU{ ... } }, .e = fmt.test.formatType max_depth.E.Two, .vec = (10.200,2.220) }, .tu = fmt.test.formatType max_depth.TU{ .ptr = fmt.test.formatType max_depth.TU{ .ptr = fmt.test.formatType max_depth.TU{ ... } } }, .e = fmt.test.formatType max_depth.E.Two, .vec = (10.200,2.220) }", fbs.getWritten()); |
| | 2583 | |
| | 2584 | const vec: @Vector(4, i32) = .{ 1, 2, 3, 4 }; |
| | 2585 | fbs.reset(); |
| | 2586 | try formatType(vec, "", FormatOptions{}, fbs.writer(), 0); |
| | 2587 | try std.testing.expectEqualStrings("{ ... }", fbs.getWritten()); |
| | 2588 | |
| | 2589 | fbs.reset(); |
| | 2590 | try formatType(vec, "", FormatOptions{}, fbs.writer(), 1); |
| | 2591 | try std.testing.expectEqualStrings("{ 1, 2, 3, 4 }", fbs.getWritten()); |
| 2580 | } | 2592 | } |
| 2581 | | 2593 | |
| 2582 | test "positional" { | 2594 | test "positional" { |