summaryrefslogtreecommitdiff
path: root/vendor/github.com/stretchr/testify/suite/stats.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-08-12 21:03:24 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-12 21:03:24 +0200
commit98263a7de64269898a2f81207e38943b5c8e8653 (patch)
tree743c90f109a6c5d27832d1dcef2388d939f0f77a /vendor/github.com/stretchr/testify/suite/stats.go
parentText duplication fix (#137) (diff)
downloadgotosocial-98263a7de64269898a2f81207e38943b5c8e8653.tar.xz
Grand test fixup (#138)
* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
Diffstat (limited to 'vendor/github.com/stretchr/testify/suite/stats.go')
-rw-r--r--vendor/github.com/stretchr/testify/suite/stats.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/github.com/stretchr/testify/suite/stats.go b/vendor/github.com/stretchr/testify/suite/stats.go
new file mode 100644
index 000000000..261da37f7
--- /dev/null
+++ b/vendor/github.com/stretchr/testify/suite/stats.go
@@ -0,0 +1,46 @@
+package suite
+
+import "time"
+
+// SuiteInformation stats stores stats for the whole suite execution.
+type SuiteInformation struct {
+ Start, End time.Time
+ TestStats map[string]*TestInformation
+}
+
+// TestInformation stores information about the execution of each test.
+type TestInformation struct {
+ TestName string
+ Start, End time.Time
+ Passed bool
+}
+
+func newSuiteInformation() *SuiteInformation {
+ testStats := make(map[string]*TestInformation)
+
+ return &SuiteInformation{
+ TestStats: testStats,
+ }
+}
+
+func (s SuiteInformation) start(testName string) {
+ s.TestStats[testName] = &TestInformation{
+ TestName: testName,
+ Start: time.Now(),
+ }
+}
+
+func (s SuiteInformation) end(testName string, passed bool) {
+ s.TestStats[testName].End = time.Now()
+ s.TestStats[testName].Passed = passed
+}
+
+func (s SuiteInformation) Passed() bool {
+ for _, stats := range s.TestStats {
+ if !stats.Passed {
+ return false
+ }
+ }
+
+ return true
+}