...
1 package types
2
3 import (
4 "strconv"
5 "time"
6 )
7
8
11
12 type SuiteSummary = DeprecatedSuiteSummary
13 type SetupSummary = DeprecatedSetupSummary
14 type SpecSummary = DeprecatedSpecSummary
15 type SpecMeasurement = DeprecatedSpecMeasurement
16 type SpecComponentType = NodeType
17 type SpecFailure = DeprecatedSpecFailure
18
19 var (
20 SpecComponentTypeInvalid = NodeTypeInvalid
21 SpecComponentTypeContainer = NodeTypeContainer
22 SpecComponentTypeIt = NodeTypeIt
23 SpecComponentTypeBeforeEach = NodeTypeBeforeEach
24 SpecComponentTypeJustBeforeEach = NodeTypeJustBeforeEach
25 SpecComponentTypeAfterEach = NodeTypeAfterEach
26 SpecComponentTypeJustAfterEach = NodeTypeJustAfterEach
27 SpecComponentTypeBeforeSuite = NodeTypeBeforeSuite
28 SpecComponentTypeSynchronizedBeforeSuite = NodeTypeSynchronizedBeforeSuite
29 SpecComponentTypeAfterSuite = NodeTypeAfterSuite
30 SpecComponentTypeSynchronizedAfterSuite = NodeTypeSynchronizedAfterSuite
31 )
32
33 type DeprecatedSuiteSummary struct {
34 SuiteDescription string
35 SuiteSucceeded bool
36 SuiteID string
37
38 NumberOfSpecsBeforeParallelization int
39 NumberOfTotalSpecs int
40 NumberOfSpecsThatWillBeRun int
41 NumberOfPendingSpecs int
42 NumberOfSkippedSpecs int
43 NumberOfPassedSpecs int
44 NumberOfFailedSpecs int
45 NumberOfFlakedSpecs int
46 RunTime time.Duration
47 }
48
49 type DeprecatedSetupSummary struct {
50 ComponentType SpecComponentType
51 CodeLocation CodeLocation
52
53 State SpecState
54 RunTime time.Duration
55 Failure SpecFailure
56
57 CapturedOutput string
58 SuiteID string
59 }
60
61 type DeprecatedSpecSummary struct {
62 ComponentTexts []string
63 ComponentCodeLocations []CodeLocation
64
65 State SpecState
66 RunTime time.Duration
67 Failure SpecFailure
68 IsMeasurement bool
69 NumberOfSamples int
70 Measurements map[string]*DeprecatedSpecMeasurement
71
72 CapturedOutput string
73 SuiteID string
74 }
75
76 func (s DeprecatedSpecSummary) HasFailureState() bool {
77 return s.State.Is(SpecStateFailureStates)
78 }
79
80 func (s DeprecatedSpecSummary) TimedOut() bool {
81 return false
82 }
83
84 func (s DeprecatedSpecSummary) Panicked() bool {
85 return s.State == SpecStatePanicked
86 }
87
88 func (s DeprecatedSpecSummary) Failed() bool {
89 return s.State == SpecStateFailed
90 }
91
92 func (s DeprecatedSpecSummary) Passed() bool {
93 return s.State == SpecStatePassed
94 }
95
96 func (s DeprecatedSpecSummary) Skipped() bool {
97 return s.State == SpecStateSkipped
98 }
99
100 func (s DeprecatedSpecSummary) Pending() bool {
101 return s.State == SpecStatePending
102 }
103
104 type DeprecatedSpecFailure struct {
105 Message string
106 Location CodeLocation
107 ForwardedPanic string
108
109 ComponentIndex int
110 ComponentType SpecComponentType
111 ComponentCodeLocation CodeLocation
112 }
113
114 type DeprecatedSpecMeasurement struct {
115 Name string
116 Info interface{}
117 Order int
118
119 Results []float64
120
121 Smallest float64
122 Largest float64
123 Average float64
124 StdDeviation float64
125
126 SmallestLabel string
127 LargestLabel string
128 AverageLabel string
129 Units string
130 Precision int
131 }
132
133 func (s DeprecatedSpecMeasurement) PrecisionFmt() string {
134 if s.Precision == 0 {
135 return "%f"
136 }
137
138 str := strconv.Itoa(s.Precision)
139
140 return "%." + str + "f"
141 }
142
View as plain text