File: comment.go

package info (click to toggle)
golang-github-go-quicktest-qt 1.101.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 236 kB
  • sloc: makefile: 2
file content (29 lines) | stat: -rw-r--r-- 794 bytes parent folder | download
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
28
29
// Licensed under the MIT license, see LICENSE file for details.

package qt

import "fmt"

// Commentf returns a test comment whose output is formatted according to
// the given format specifier and args. It may be provided as the last argument
// to any check or assertion and will be displayed if the check or assertion
// fails.
func Commentf(format string, args ...any) Comment {
	return Comment{
		format: format,
		args:   args,
	}
}

// Comment represents additional information on a check or an assertion which is
// displayed when the check or assertion fails.
type Comment struct {
	format string
	args   []any
}

// String outputs a string formatted according to the stored format specifier
// and args.
func (c Comment) String() string {
	return fmt.Sprintf(c.format, c.args...)
}