File: fixture_method_info.go

package info (click to toggle)
golang-github-smartystreets-gunit 1.2.0%2Bgit20180314.6f0d627-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 200 kB
  • sloc: makefile: 5
file content (36 lines) | stat: -rw-r--r-- 1,161 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
30
31
32
33
34
35
36
package gunit

import "strings"

type fixtureMethodInfo struct {
	name          string
	isSetup       bool
	isTeardown    bool
	isTest        bool
	isFocusTest   bool
	isLongTest    bool
	isSkippedTest bool
}

func (this *fixtureRunner) newFixtureMethodInfo(name string) fixtureMethodInfo {
	var (
		isSetup           = strings.HasPrefix(name, "Setup")
		isTeardown        = strings.HasPrefix(name, "Teardown")
		isTest            = strings.HasPrefix(name, "Test")
		isLongTest        = strings.HasPrefix(name, "LongTest")
		isFocusTest       = strings.HasPrefix(name, "FocusTest")
		isFocusLongTest   = strings.HasPrefix(name, "FocusLongTest")
		isSkippedTest     = strings.HasPrefix(name, "SkipTest")
		isSkippedLongTest = strings.HasPrefix(name, "SkipLongTest")
	)

	return fixtureMethodInfo{
		name:          name,
		isSetup:       isSetup,
		isTeardown:    isTeardown,
		isLongTest:    isLongTest || isSkippedLongTest || isFocusLongTest,
		isFocusTest:   isFocusTest || isFocusLongTest,
		isSkippedTest: isSkippedTest || isSkippedLongTest,
		isTest:        isTest || isLongTest || isSkippedTest || isSkippedLongTest || isFocusTest || isFocusLongTest,
	}
}