prefer strings.Contains
Vladimir Bauer
9 years ago
| 96 | 96 | |
| 97 | 97 | p.Stop() |
| 98 | 98 | |
| 99 | bytes := removeLastRune(buf.Bytes()) | |
| 100 | got := string(bytes[len(bytes)-customWidth:]) | |
| 99 | got := buf.String() | |
| 101 | 100 | want := fmt.Sprintf("[%s]", strings.Repeat("=", customWidth-2)) |
| 102 | if got != want { | |
| 101 | if !strings.Contains(buf.String(), want) { | |
| 103 | 102 | t.Errorf("Expected format: %s, got %s\n", want, got) |
| 104 | 103 | } |
| 105 | 104 | } |