2024-12-22 23:33:19 +08:00
|
|
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
|
|
package templates
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestCountFmt(t *testing.T) {
|
|
|
|
|
assert.Equal(t, "125", countFmt(125))
|
|
|
|
|
assert.Equal(t, "1.3k", countFmt(int64(1317)))
|
|
|
|
|
assert.Equal(t, "21.3M", countFmt(21317675))
|
2025-08-20 08:20:22 -07:00
|
|
|
assert.Equal(t, "45.7G", countFmt(int64(45721317675)))
|
2025-03-31 07:53:48 +02:00
|
|
|
assert.Empty(t, countFmt("test"))
|
2024-12-22 23:33:19 +08:00
|
|
|
}
|