truncatingFormat formats the data and truncates it if it's too long. This helps keep formatted error messages lines from exceeding the bufio.MaxScanTokenSize max line length that the go testing framework imposes.
(data interface{})
| 619 | // This helps keep formatted error messages lines from exceeding the |
| 620 | // bufio.MaxScanTokenSize max line length that the go testing framework imposes. |
| 621 | func truncatingFormat(data interface{}) string { |
| 622 | value := fmt.Sprintf("%#v", data) |
| 623 | max := bufio.MaxScanTokenSize - 100 // Give us some space the type info too if needed. |
| 624 | if len(value) > max { |
| 625 | value = value[0:max] + "<... truncated>" |
| 626 | } |
| 627 | return value |
| 628 | } |
| 629 | |
| 630 | // EqualValues asserts that two objects are equal or convertible to the larger |
| 631 | // type and equal. |
no outgoing calls