Construct chain using DefaultAssertionHandler and provided Reporter.
(name string, reporter Reporter, flag ...chainFlags)
| 140 | |
| 141 | // Construct chain using DefaultAssertionHandler and provided Reporter. |
| 142 | func newChainWithDefaults(name string, reporter Reporter, flag ...chainFlags) *chain { |
| 143 | if reporter == nil { |
| 144 | panic("Reporter is nil") |
| 145 | } |
| 146 | |
| 147 | c := &chain{ |
| 148 | context: AssertionContext{}, |
| 149 | handler: &DefaultAssertionHandler{ |
| 150 | Formatter: &DefaultFormatter{}, |
| 151 | Reporter: reporter, |
| 152 | }, |
| 153 | severity: SeverityError, |
| 154 | } |
| 155 | |
| 156 | if name != "" { |
| 157 | c.context.Path = []string{name} |
| 158 | c.context.AliasedPath = []string{name} |
| 159 | } else { |
| 160 | c.context.Path = []string{} |
| 161 | c.context.AliasedPath = []string{} |
| 162 | } |
| 163 | |
| 164 | c.context.Environment = newEnvironment(c) |
| 165 | |
| 166 | c.context.TestingTB = isTestingTB(c.handler) |
| 167 | |
| 168 | for _, f := range flag { |
| 169 | c.flags |= f |
| 170 | } |
| 171 | |
| 172 | return c |
| 173 | } |
| 174 | |
| 175 | // Get environment instance. |
| 176 | // Root chain constructor either gets environment from config or creates a new one. |
searching dependent graphs…