(t *testing.T)
| 213 | } |
| 214 | |
| 215 | func TestAssign(t *testing.T) { |
| 216 | baseConfig := currentConfig() |
| 217 | defer setCurrentConfig(baseConfig) |
| 218 | |
| 219 | // Test assigning to a simple field. |
| 220 | if err := configure("nodecount", "20"); err != nil { |
| 221 | t.Errorf("error setting nodecount: %v", err) |
| 222 | } |
| 223 | if n := currentConfig().NodeCount; n != 20 { |
| 224 | t.Errorf("incorrect nodecount; expecting 20, got %d", n) |
| 225 | } |
| 226 | |
| 227 | // Test assignment to a group field. |
| 228 | if err := configure("granularity", "files"); err != nil { |
| 229 | t.Errorf("error setting granularity: %v", err) |
| 230 | } |
| 231 | if g := currentConfig().Granularity; g != "files" { |
| 232 | t.Errorf("incorrect granularity; expecting %v, got %v", "files", g) |
| 233 | } |
| 234 | |
| 235 | // Test assignment to one choice of a group field. |
| 236 | if err := configure("lines", "t"); err != nil { |
| 237 | t.Errorf("error setting lines: %v", err) |
| 238 | } |
| 239 | if g := currentConfig().Granularity; g != "lines" { |
| 240 | t.Errorf("incorrect granularity; expecting %v, got %v", "lines", g) |
| 241 | } |
| 242 | |
| 243 | // Test assignment to invalid choice, |
| 244 | if err := configure("granularity", "cheese"); err == nil { |
| 245 | t.Errorf("allowed assignment of invalid granularity") |
| 246 | } |
| 247 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…