File: comment_test.go

package info (click to toggle)
golang-github-frankban-quicktest 1.14.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 332 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Licensed under the MIT license, see LICENSE file for details.

package quicktest_test

import (
	"testing"

	qt "github.com/frankban/quicktest"
)

func TestCommentf(t *testing.T) {
	c := qt.Commentf("the answer is %d", 42)
	comment := c.String()
	expectedComment := "the answer is 42"
	if comment != expectedComment {
		t.Fatalf("comment error:\ngot  %q\nwant %q", comment, expectedComment)
	}
}

func TestConstantCommentf(t *testing.T) {
	const expectedComment = "bad wolf"
	c := qt.Commentf(expectedComment)
	comment := c.String()
	if comment != expectedComment {
		t.Fatalf("constant comment error:\ngot  %q\nwant %q", comment, expectedComment)
	}
}