php-parser/internal/version/version_test.go

30 lines
494 B
Go
Raw Normal View History

2020-05-18 19:37:13 +00:00
package version_test
import (
"gotest.tools/assert"
"testing"
"github.com/z7zmey/php-parser/internal/version"
)
func TestSmaller(t *testing.T) {
r, err := version.Compare("7.3", "5.6")
assert.NilError(t, err)
assert.Equal(t, 1, r)
}
func TestGreater(t *testing.T) {
r, err := version.Compare("5.6", "7.3")
assert.NilError(t, err)
assert.Equal(t, -1, r)
}
func TestEqual(t *testing.T) {
r, err := version.Compare("7.3", "7.3")
assert.NilError(t, err)
assert.Equal(t, 0, r)
}