package releases import "testing" func TestCompareVersion(t *testing.T) { cases := []struct { a string b string want int }{ {"2.0.6.31", "2.0.6.2", 1}, {"2.0.10", "2.0.9", 1}, {"2.0.6.2", "2.0.6.31", -1}, {"2.0.6", "2.0.6.0", 0}, } for _, tc := range cases { if got := compareVersion(tc.a, tc.b); got != tc.want { t.Fatalf("compareVersion(%q, %q) = %d, want %d", tc.a, tc.b, got, tc.want) } } } func TestDetectPackageMetadata(t *testing.T) { platform, arch := detectPlatform("YMhutBox_2.0.6.31_x64.msix") if platform != "windows" || arch != "x64" { t.Fatalf("detectPlatform returned %s/%s", platform, arch) } if version := detectVersion("YMhut_Box_WinUI_Setup_2.0.6.31.exe"); version != "2.0.6.31" { t.Fatalf("detectVersion returned %q", version) } }