|
1 | | -//go:build !musl && !windows |
| 1 | +//go:build !musl |
2 | 2 |
|
3 | 3 | package proxy |
4 | 4 |
|
@@ -216,6 +216,31 @@ func TestViaManagedRunnerOptionsMapConfig(t *testing.T) { |
216 | 216 | } |
217 | 217 | } |
218 | 218 |
|
| 219 | +func TestViaModeDefaults(t *testing.T) { |
| 220 | + tests := []struct { |
| 221 | + name string |
| 222 | + mode string |
| 223 | + goos string |
| 224 | + libraryPath string |
| 225 | + want vialite.Mode |
| 226 | + }{ |
| 227 | + {name: "linux empty defaults subprocess", mode: "", goos: "linux", want: vialite.ModeSubprocess}, |
| 228 | + {name: "linux explicit embedded", mode: "embedded", goos: "linux", want: vialite.ModeEmbedded}, |
| 229 | + {name: "linux subprocess", mode: "subprocess", goos: "linux", want: vialite.ModeSubprocess}, |
| 230 | + {name: "windows empty defaults subprocess", mode: "", goos: "windows", want: vialite.ModeSubprocess}, |
| 231 | + {name: "windows explicit embedded uses subprocess", mode: "embedded", goos: "windows", want: vialite.ModeSubprocess}, |
| 232 | + {name: "windows custom library explicit embedded", mode: "embedded", goos: "windows", libraryPath: "C:\\vialite\\libvialite.dll", want: vialite.ModeEmbedded}, |
| 233 | + {name: "windows subprocess", mode: "subprocess", goos: "windows", want: vialite.ModeSubprocess}, |
| 234 | + } |
| 235 | + for _, tt := range tests { |
| 236 | + t.Run(tt.name, func(t *testing.T) { |
| 237 | + if got := viaMode(tt.mode, tt.goos, tt.libraryPath); got != tt.want { |
| 238 | + t.Fatalf("viaMode(%q, %q, %q) = %v, want %v", tt.mode, tt.goos, tt.libraryPath, got, tt.want) |
| 239 | + } |
| 240 | + }) |
| 241 | + } |
| 242 | +} |
| 243 | + |
219 | 244 | func TestViaManagedRunnerOptionsUseConfiguredServerNames(t *testing.T) { |
220 | 245 | cfg := &config.Config{ |
221 | 246 | Servers: map[string]string{ |
|
0 commit comments