Translate Chinese comments, log/error messages, validator labels and Swagger annotations to English throughout the source code, generated Swagger docs, config files and CI workflows. Make the English README primary: README.md now holds the English docs and README_EN.md holds the Chinese version, with cross-language links updated accordingly. Note: the generated docs/ swagger files were translated in place; run `go generate ./...` (swag init) to regenerate them from the now-English annotations when a Go toolchain is available. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
655 B
Go
34 lines
655 B
Go
package service
|
|
|
|
import (
|
|
"sync"
|
|
"testing"
|
|
)
|
|
|
|
// TestGetAppVersion
|
|
func TestGetAppVersion(t *testing.T) {
|
|
s := &AppService{}
|
|
v := s.GetAppVersion()
|
|
// print result
|
|
t.Logf("App Version: %s", v)
|
|
}
|
|
|
|
func TestMultipleGetAppVersion(t *testing.T) {
|
|
s := &AppService{}
|
|
//concurrency test
|
|
// use a WaitGroup to wait for all goroutines to finish
|
|
wg := sync.WaitGroup{}
|
|
wg.Add(10) // start 10 goroutine
|
|
// start 10 goroutine
|
|
for i := 0; i < 10; i++ {
|
|
go func() {
|
|
defer wg.Done() // decrement the count when done
|
|
v := s.GetAppVersion()
|
|
// print result
|
|
t.Logf("App Version: %s", v)
|
|
}()
|
|
}
|
|
// wait for all goroutine done
|
|
wg.Wait()
|
|
}
|