| 1 |
// Licensed under the MIT license, see LICENSE file for details. |
| 2 |
|
| 3 |
package qt_test |
| 4 |
|
| 5 |
import ( |
| 6 |
"testing" |
| 7 |
|
| 8 |
"github.com/go-quicktest/qt" |
| 9 |
) |
| 10 |
|
| 11 |
func TestCommentf(t *testing.T) { |
| 12 |
c := qt.Commentf("the answer is %d", 42) |
| 13 |
comment := c.String() |
| 14 |
expectedComment := "the answer is 42" |
| 15 |
if comment != expectedComment { |
| 16 |
t.Fatalf("comment error:\ngot %q\nwant %q", comment, expectedComment) |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
func TestConstantCommentf(t *testing.T) { |
| 21 |
const expectedComment = "bad wolf" |
| 22 |
c := qt.Commentf(expectedComment) |
| 23 |
comment := c.String() |
| 24 |
if comment != expectedComment { |
| 25 |
t.Fatalf("constant comment error:\ngot %q\nwant %q", comment, expectedComment) |
| 26 |
} |
| 27 |
} |