(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func TestConfigWithInvalidPaths(t *testing.T) { |
| 89 | tests := []struct { |
| 90 | desc string |
| 91 | output string |
| 92 | errOutput string |
| 93 | }{ |
| 94 | {"output directory doesn't exist", "/tmp/not-there/foo.log", "stderr"}, |
| 95 | {"error output directory doesn't exist", "stdout", "/tmp/not-there/foo-errors.log"}, |
| 96 | {"neither output directory exists", "/tmp/not-there/foo.log", "/tmp/not-there/foo-errors.log"}, |
| 97 | } |
| 98 | |
| 99 | for _, tt := range tests { |
| 100 | t.Run(tt.desc, func(t *testing.T) { |
| 101 | cfg := NewProductionConfig() |
| 102 | cfg.OutputPaths = []string{tt.output} |
| 103 | cfg.ErrorOutputPaths = []string{tt.errOutput} |
| 104 | _, err := cfg.Build() |
| 105 | assert.Error(t, err, "Expected an error opening a non-existent directory.") |
| 106 | }) |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | func TestConfigWithMissingAttributes(t *testing.T) { |
| 111 | tests := []struct { |
nothing calls this directly
no test coverage detected