(diffs []string)
| 897 | return nil |
| 898 | } |
| 899 | func (d *DiffsPrinter) TableWriter(diffs []string) error { |
| 900 | |
| 901 | var opts []tablewriter.Option |
| 902 | opts = append(opts, tablewriter.WithHeaderAutoWrap(tw.WrapNone)) |
| 903 | opts = append(opts, tablewriter.WithRowAutoWrap(tw.WrapNone)) |
| 904 | opts = append(opts, tablewriter.WithTrimSpace(tw.Off)) |
| 905 | if !models.IsAnsiDisabled { |
| 906 | opts = append(opts, tablewriter.WithRenderer(newDiffTableRenderer())) |
| 907 | } |
| 908 | opts = append(opts, tablewriter.WithRowAlignment(tw.AlignCenter)) |
| 909 | table := tablewriter.NewTable(d.out, opts...) |
| 910 | table.Header([]string{d.testCase}) |
| 911 | |
| 912 | for _, e := range diffs { |
| 913 | table.Append([]string{e}) |
| 914 | } |
| 915 | if d.hasarrayIndexMismatch { |
| 916 | startPart := " Expected and actual value" |
| 917 | var midPartpaint string |
| 918 | |
| 919 | if len(d.text) > 0 { |
| 920 | if !models.IsAnsiDisabled { |
| 921 | midPartpaint = color.New(color.FgRed).SprintFunc()(d.text) |
| 922 | } else { |
| 923 | midPartpaint = d.text |
| 924 | } |
| 925 | startPart += " of " |
| 926 | } |
| 927 | |
| 928 | initalPart := utils.WarningSign + startPart |
| 929 | endPaint := " are in different order but have the same objects" |
| 930 | |
| 931 | if !models.IsAnsiDisabled { |
| 932 | yellowPaint := color.New(color.FgYellow).SprintFunc() |
| 933 | initalPart = yellowPaint(initalPart) |
| 934 | endPaint = yellowPaint(endPaint) |
| 935 | } |
| 936 | |
| 937 | table.Append([]string{initalPart + midPartpaint + endPaint}) |
| 938 | } |
| 939 | table.Render() |
| 940 | return nil |
| 941 | } |
| 942 | |
| 943 | func (d *DiffsPrinter) RenderAppender() error { |
| 944 | //Only show difference for the response body |
no test coverage detected