From 9a74999263672ba2dc0ec9a0c3edae1910e73123 Mon Sep 17 00:00:00 2001 From: Markus Linnala Date: Tue, 22 Feb 2022 14:52:00 +0200 Subject: [PATCH] TestMustGetParsedDuration: drop version tests Fails: % go version go version go1.18beta2 linux/amd64 As per: https://go.dev/doc/devel/release#policy Supported versions are today 1.16 and 1.17, so we can drop this brittle check. --- properties_test.go | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/properties_test.go b/properties_test.go index 7fc2e94..adde065 100644 --- a/properties_test.go +++ b/properties_test.go @@ -11,8 +11,6 @@ import ( "os" "reflect" "regexp" - "runtime" - "strconv" "strings" "testing" "time" @@ -560,24 +558,7 @@ func TestMustGetParsedDuration(t *testing.T) { input := "key = 123ms\nkey2 = ghi" p := mustParse(t, input) assert.Equal(t, p.MustGetParsedDuration("key"), 123*time.Millisecond) - - // parse runtime.Version into major and minor version - var major, minor int - ver := strings.Split(runtime.Version(), ".") - devel := !strings.HasPrefix(ver[0], "go") - major, _ = strconv.Atoi(strings.TrimPrefix(ver[0], "go")) - if len(ver) > 1 { - minor, _ = strconv.Atoi(ver[1]) - } - - switch { - case devel || major == 1 && minor >= 15: - // go1.15 ... gotip - assert.Panic(t, func() { p.MustGetParsedDuration("key2") }, `time: invalid duration "ghi"`) - default: - // go1.x..go1.14 - assert.Panic(t, func() { p.MustGetParsedDuration("key2") }, `time: invalid duration ghi`) - } + assert.Panic(t, func() { p.MustGetParsedDuration("key2") }, `time: invalid duration "ghi"`) assert.Panic(t, func() { p.MustGetParsedDuration("invalid") }, "unknown property: invalid") }