You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_language_stats_test.go 738B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. //go:build !gogit
  5. package git
  6. import (
  7. "path/filepath"
  8. "testing"
  9. "github.com/stretchr/testify/assert"
  10. )
  11. func TestRepository_GetLanguageStats(t *testing.T) {
  12. repoPath := filepath.Join(testReposDir, "language_stats_repo")
  13. gitRepo, err := openRepositoryWithDefaultContext(repoPath)
  14. if !assert.NoError(t, err) {
  15. t.Fatal()
  16. }
  17. defer gitRepo.Close()
  18. stats, err := gitRepo.GetLanguageStats("8fee858da5796dfb37704761701bb8e800ad9ef3")
  19. if !assert.NoError(t, err) {
  20. t.Fatal()
  21. }
  22. assert.EqualValues(t, map[string]int64{
  23. "Python": 134,
  24. "Java": 112,
  25. }, stats)
  26. }