File: testing.go

package info (click to toggle)
golang-github-jeremija-gosubmit 0.2.8-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 176 kB
  • sloc: makefile: 7
file content (29 lines) | stat: -rw-r--r-- 460 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
28
29
package gosubmit

import (
	"net/http"
)

type test interface {
	Fatalf(format string, values ...interface{})
	Helper()
}

type TestingForm struct {
	form Form
	t    test
}

func (f TestingForm) assertNoError(err error) {
	f.t.Helper()
	if err != nil {
		f.t.Fatalf("An error occurred: %s", err)
	}
}

func (f TestingForm) NewTestRequest(opts ...Option) *http.Request {
	f.t.Helper()
	r, err := f.form.NewTestRequest(opts...)
	f.assertNoError(err)
	return r
}