(t *testing.T)
| 114 | } |
| 115 | |
| 116 | func TestBuildMSYS2Command_MsvcEnvsOrder(t *testing.T) { |
| 117 | executor := NewExecutor("", "make install", "DESTDIR=/tmp"). |
| 118 | SetMsvcEnvs(`call "C:\VC\vcvarsall.bat" x64 > nul &&`) |
| 119 | |
| 120 | var displayCmd string |
| 121 | cmd := executor.buildMSYS2Command(&displayCmd) |
| 122 | |
| 123 | parts := strings.SplitN(displayCmd, " ", 2) |
| 124 | if !strings.HasPrefix(parts[0], "call") { |
| 125 | t.Errorf("msvcEnvs should come first in displayCmd, got: %s", displayCmd) |
| 126 | } |
| 127 | |
| 128 | bashCmd := cmd.Args[2] |
| 129 | msvcIdx := strings.Index(bashCmd, "call") |
| 130 | cmdIdx := strings.Index(bashCmd, "make install") |
| 131 | if msvcIdx > cmdIdx { |
| 132 | t.Errorf("msvcEnvs should appear before command in bash command, got: %s", bashCmd) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | func TestBuildNativeCommand_NoArgs(t *testing.T) { |
| 137 | var displayCmd string |
nothing calls this directly
no test coverage detected