github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/common/badversion/version_test.go (about) 1 package badversion 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 ) 8 9 func TestCompareVersion(t *testing.T) { 10 t.Parallel() 11 require.Equal(t, "1.3.0-beta.1", Parse("v1.3.0-beta1").String()) 12 require.Equal(t, "1.3-beta1", Parse("v1.3.0-beta.1").BadString()) 13 require.True(t, Parse("1.3.0").After(Parse("1.3-beta1"))) 14 require.True(t, Parse("1.3.0").After(Parse("1.3.0-beta1"))) 15 require.True(t, Parse("1.3.0-beta1").After(Parse("1.3.0-alpha1"))) 16 require.True(t, Parse("1.3.1").After(Parse("1.3.0"))) 17 require.True(t, Parse("1.4").After(Parse("1.3"))) 18 }