Debian Codegraph @

test_cases/passing.test.go

raw symbols SCIP
1 // Copyright 2011 Aaron Jacobs. All Rights Reserved.
2 // Author: [email protected] (Aaron Jacobs)
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15
16 package oglematchers_test
17
18 import (
19 "fmt"
20 "testing"
21 "time"
22
23 . "github.com/jacobsa/oglematchers"
24 . "github.com/jacobsa/ogletest"
25 )
26
27 func TestPassingTest(t *testing.T) { RunTests(t) }
28
29 ////////////////////////////////////////////////////////////////////////
30 // PassingTest
31 ////////////////////////////////////////////////////////////////////////
32
33 type PassingTest struct {
34 }
35
36 func init() { RegisterTestSuite(&PassingTest{}) }
37
38 func (t *PassingTest) EmptyTestMethod() {
39 }
40
41 func (t *PassingTest) SuccessfullMatches() {
42 ExpectThat(17, Equals(17.0))
43 ExpectThat(16.9, LessThan(17))
44 ExpectThat("taco", HasSubstr("ac"))
45
46 AssertThat(17, Equals(17.0))
47 AssertThat(16.9, LessThan(17))
48 AssertThat("taco", HasSubstr("ac"))
49 }
50
51 func (t *PassingTest) ExpectAliases() {
52 ExpectEq(17, 17.0)
53
54 ExpectLe(17, 17.0)
55 ExpectLe(17, 18.0)
56 ExpectLt(17, 18.0)
57
58 ExpectGe(17, 17.0)
59 ExpectGe(17, 16.0)
60 ExpectGt(17, 16.0)
61
62 ExpectNe(17, 18.0)
63
64 ExpectTrue(true)
65 ExpectFalse(false)
66 }
67
68 func (t *PassingTest) AssertAliases() {
69 AssertEq(17, 17.0)
70
71 AssertLe(17, 17.0)
72 AssertLe(17, 18.0)
73 AssertLt(17, 18.0)
74
75 AssertGe(17, 17.0)
76 AssertGe(17, 16.0)
77 AssertGt(17, 16.0)
78
79 AssertNe(17, 18.0)
80
81 AssertTrue(true)
82 AssertFalse(false)
83 }
84
85 func (t *PassingTest) SlowTest() {
86 time.Sleep(37 * time.Millisecond)
87 }
88
89 ////////////////////////////////////////////////////////////////////////
90 // PassingTestWithHelpers
91 ////////////////////////////////////////////////////////////////////////
92
93 type PassingTestWithHelpers struct {
94 }
95
96 var _ SetUpTestSuiteInterface = &PassingTestWithHelpers{}
97 var _ SetUpInterface = &PassingTestWithHelpers{}
98 var _ TearDownInterface = &PassingTestWithHelpers{}
99 var _ TearDownTestSuiteInterface = &PassingTestWithHelpers{}
100
101 func init() { RegisterTestSuite(&PassingTestWithHelpers{}) }
102
103 func (t *PassingTestWithHelpers) SetUpTestSuite() {
104 fmt.Println("SetUpTestSuite ran.")
105 }
106
107 func (t *PassingTestWithHelpers) SetUp(ti *TestInfo) {
108 fmt.Println("SetUp ran.")
109 }
110
111 func (t *PassingTestWithHelpers) TearDown() {
112 fmt.Println("TearDown ran.")
113 }
114
115 func (t *PassingTestWithHelpers) TearDownTestSuite() {
116 fmt.Println("TearDownTestSuite ran.")
117 }
118
119 func (t *PassingTestWithHelpers) EmptyTestMethod() {
120 }