File: xunit_test.go

package info (click to toggle)
golang-ginkgo 1.2.0%2Bgit20161006.acfa16a-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,324 kB
  • ctags: 1,210
  • sloc: makefile: 12
file content (41 lines) | stat: -rw-r--r-- 733 bytes parent folder | download | duplicates (5)
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
37
38
39
40
41
package tmp

import (
	"testing"
)

type UselessStruct struct {
	ImportantField string
	T              *testing.T
}

var testFunc = func(t *testing.T, arg *string) {}

func assertEqual(t *testing.T, arg1, arg2 interface{}) {
	if arg1 != arg2 {
		t.Fail()
	}
}

func TestSomethingImportant(t *testing.T) {
	whatever := &UselessStruct{
		T:              t,
		ImportantField: "SECRET_PASSWORD",
	}
	something := &UselessStruct{ImportantField: "string value"}
	assertEqual(t, whatever.ImportantField, "SECRET_PASSWORD")
	assertEqual(t, something.ImportantField, "string value")

	var foo = func(t *testing.T) {}
	foo(t)

	strp := "something"
	testFunc(t, &strp)
	t.Fail()
}

func Test3Things(t *testing.T) {
	if 3 != 3 {
		t.Fail()
	}
}