File size: 1,596 Bytes
530729e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
package utils
import (
"html/template"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCompressedContent(t *testing.T) {
htmlContent1 := template.HTML(`
<html>
<body>
<h1>Test</h1>
<p>CompressedContent</p>
</body>
</html>
`)
htmlContent2 := htmlContent1
CompressedContent(&htmlContent2)
t.Log(len(htmlContent1) > len(htmlContent2))
}
func TestCompareVersion(t *testing.T) {
assert.Equal(t, true, CompareVersion("v1.2.4", "v1.2.5"))
assert.Equal(t, false, CompareVersion("v1.2.4", "v1.2.4"))
assert.Equal(t, false, CompareVersion("v1.2.4", "v1.2.3"))
assert.Equal(t, false, CompareVersion("v1.2.4", "v1.1.3"))
assert.Equal(t, true, CompareVersion("v1.2.4", "v1.3.3"))
assert.Equal(t, false, CompareVersion("v1.2.4", "v0.3.3"))
assert.Equal(t, true, CompareVersion("<v1.2.4", "v0.3.3"))
assert.Equal(t, false, CompareVersion("<v1.2.4", "v1.2.5"))
assert.Equal(t, true, CompareVersion("<=v1.2.4", "v1.2.4"))
assert.Equal(t, true, CompareVersion("<=v1.2.4", "v1.2.3"))
assert.Equal(t, false, CompareVersion("<=v1.2.4", "v1.2.5"))
assert.Equal(t, true, CompareVersion(">v1.2.4", "v1.2.5"))
assert.Equal(t, false, CompareVersion(">v1.2.4", "v1.2.4"))
assert.Equal(t, true, CompareVersion(">=v1.2.4", "v1.2.4"))
assert.Equal(t, true, CompareVersion(">=v1.2.4", "v1.2.5"))
assert.Equal(t, false, CompareVersion(">=v1.2.4", "v1.2.3"))
assert.Equal(t, false, CompareVersion("=v1.2.4", "v1.2.3"))
assert.Equal(t, true, CompareVersion("=v1.2.4", "v1.2.4"))
assert.Equal(t, true, CompareVersion("= v1.2.4", "v1.2.4"))
}
|