mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-06 21:52:25 +00:00
Project structure refactor:
- Change package name general_server to gateway - Changing the structure of directories and packages - Adding vendor to the project
This commit is contained in:
30
internal/core/update/update_test.go
Normal file
30
internal/core/update/update_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package update
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFunc_isVersionNewer(t *testing.T) {
|
||||
tests := []struct {
|
||||
current string
|
||||
latest string
|
||||
want bool
|
||||
}{
|
||||
{"1.0.0", "1.0.0", false},
|
||||
{"1.0.0", "1.0.1", true},
|
||||
{"1.0.1", "1.0.0", false},
|
||||
{"2.0.0", "1.9.9", false},
|
||||
{"2.2.3", "1.9.9", false},
|
||||
{"22.2.3", "1.9.9", false},
|
||||
{"1.2.3", "1.99.9", true},
|
||||
{"1.10", "1.5.99999", false},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.current+" vs "+tt.latest, func(t *testing.T) {
|
||||
if got := isVersionNewer(Version(tt.current), Version(tt.latest)); got != tt.want {
|
||||
t.Errorf("isVersionNewer(%q, %q) = %v; want %v", tt.current, tt.latest, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user