Files
GoSally/core/update/update_test.go
alex d442871950 Refactor configuration and update handling:
- Modify .luarc.json to include global Lua scripts.
- Update Makefile to include LDFLAGS for versioning.
- Enhance node.go to implement version checking and update handling.
- Refactor Lua global variables in _globals.lua and echo.lua to use new structures.
- Remove deprecated http.lua and update config.yaml for TLS and update settings.
- Introduce new update.go for version management and update checking.
- Add tests for version comparison in update_test.go.
- Improve error handling in various server methods.
2025-07-03 22:38:05 +03:00

31 lines
675 B
Go

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)
}
})
}
}