9a5720e8ad
Branch Policy Check / Verify merge target (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
PR RC Release / Build RC Release (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Branch Cleanup / Delete merged branch (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Full namespace migration: update the Go module path and all import statements from git.mokoconsulting.tech to code.mokoconsulting.tech. Also updates all URL references in templates, workflows, configs, tests, and documentation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
33 lines
943 B
Go
33 lines
943 B
Go
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package translation
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/translation/i18n"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPrettyNumber(t *testing.T) {
|
|
// TODO: make this package friendly to testing
|
|
|
|
i18n.ResetDefaultLocales()
|
|
|
|
allLangMap = make(map[string]*LangType)
|
|
allLangMap["id-ID"] = &LangType{Lang: "id-ID", Name: "Bahasa Indonesia"}
|
|
|
|
l := NewLocale("id-ID")
|
|
assert.Equal(t, "1.000.000", l.PrettyNumber(1000000))
|
|
assert.Equal(t, "1.000.000,1", l.PrettyNumber(1000000.1))
|
|
assert.Equal(t, "1.000.000", l.PrettyNumber("1000000"))
|
|
assert.Equal(t, "1.000.000", l.PrettyNumber("1000000.0"))
|
|
assert.Equal(t, "1.000.000,1", l.PrettyNumber("1000000.1"))
|
|
|
|
l = NewLocale("nosuch")
|
|
assert.Equal(t, "1,000,000", l.PrettyNumber(1000000))
|
|
assert.Equal(t, "1,000,000.1", l.PrettyNumber(1000000.1))
|
|
}
|