mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-19 20:57:53 +02:00
Maybe 3rd time is the charm! This makes the CI build run on windows too, and fix broken tests/featuers on Windows. Most of the changes are related to ignoring certain tests on windows, or making sure to use the right path separators. More work to do in the future, probably! #4293 --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
49 lines
923 B
Go
49 lines
923 B
Go
package testlib
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCheckPath(t *testing.T) {
|
|
requireSkipped := func(tb testing.TB, skipped bool) {
|
|
tb.Helper()
|
|
t.Cleanup(func() {
|
|
require.Equalf(tb, skipped, tb.Skipped(), "expected skipped to be %v", skipped)
|
|
})
|
|
}
|
|
|
|
t.Run("local", func(t *testing.T) {
|
|
t.Setenv("CI", "false")
|
|
|
|
t.Run("in path", func(t *testing.T) {
|
|
requireSkipped(t, false)
|
|
if IsWindows() {
|
|
CheckPath(t, "cmd.exe")
|
|
} else {
|
|
CheckPath(t, "echo")
|
|
}
|
|
})
|
|
|
|
t.Run("not in path", func(t *testing.T) {
|
|
requireSkipped(t, true)
|
|
CheckPath(t, "do-not-exist")
|
|
})
|
|
})
|
|
|
|
t.Run("CI", func(t *testing.T) {
|
|
t.Setenv("CI", "true")
|
|
|
|
t.Run("in path on CI", func(t *testing.T) {
|
|
requireSkipped(t, false)
|
|
CheckPath(t, "echo")
|
|
})
|
|
|
|
t.Run("not in path on CI", func(t *testing.T) {
|
|
requireSkipped(t, false)
|
|
CheckPath(t, "do-not-exist")
|
|
})
|
|
})
|
|
}
|