aboutsummaryrefslogtreecommitdiffstats
path: root/modules/base/tool_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/base/tool_test.go')
-rw-r--r--modules/base/tool_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/base/tool_test.go b/modules/base/tool_test.go
index cadb851858..f765fd0db0 100644
--- a/modules/base/tool_test.go
+++ b/modules/base/tool_test.go
@@ -223,5 +223,13 @@ func TestIsTextFile(t *testing.T) {
assert.True(t, IsTextFile([]byte("lorem ipsum")))
}
+func TestFormatNumberSI(t *testing.T) {
+ assert.Equal(t, "125", FormatNumberSI(int(125)))
+ assert.Equal(t, "1.3k", FormatNumberSI(int64(1317)))
+ assert.Equal(t, "21.3M", FormatNumberSI(21317675))
+ assert.Equal(t, "45.7G", FormatNumberSI(45721317675))
+ assert.Equal(t, "", FormatNumberSI("test"))
+}
+
// TODO: IsImageFile(), currently no idea how to test
// TODO: IsPDFFile(), currently no idea how to test