Construct chain using config.
(name string, config Config)
| 109 | |
| 110 | // Construct chain using config. |
| 111 | func newChainWithConfig(name string, config Config) *chain { |
| 112 | config.validate() |
| 113 | |
| 114 | c := &chain{ |
| 115 | context: AssertionContext{}, |
| 116 | handler: config.AssertionHandler, |
| 117 | severity: SeverityError, |
| 118 | } |
| 119 | |
| 120 | c.context.TestName = config.TestName |
| 121 | |
| 122 | if name != "" { |
| 123 | c.context.Path = []string{name} |
| 124 | c.context.AliasedPath = []string{name} |
| 125 | } else { |
| 126 | c.context.Path = []string{} |
| 127 | c.context.AliasedPath = []string{} |
| 128 | } |
| 129 | |
| 130 | if config.Environment != nil { |
| 131 | c.context.Environment = config.Environment |
| 132 | } else { |
| 133 | c.context.Environment = newEnvironment(c) |
| 134 | } |
| 135 | |
| 136 | c.context.TestingTB = isTestingTB(c.handler) |
| 137 | |
| 138 | return c |
| 139 | } |
| 140 | |
| 141 | // Construct chain using DefaultAssertionHandler and provided Reporter. |
| 142 | func newChainWithDefaults(name string, reporter Reporter, flag ...chainFlags) *chain { |
searching dependent graphs…