mirror of
https://github.com/go-gitea/gitea
synced 2024-10-31 23:34:25 +00:00
b231d0deab
* Ignore Sync errors on pipes when doing `CheckAttributeReader.CheckPath` * apply env patch * Drop the Sync and fix a number of issues with the Close function Signed-off-by: Andrew Thornton <art27@cantab.net> * add logs for DBIndexer and CheckPath * Fix some more closing bugs Signed-off-by: Andrew Thornton <art27@cantab.net> * Add test case for language_stats Signed-off-by: Andrew Thornton <art27@cantab.net> * Update modules/indexer/stats/db.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
35 lines
737 B
Go
35 lines
737 B
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build !gogit
|
|
// +build !gogit
|
|
|
|
package git
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRepository_GetLanguageStats(t *testing.T) {
|
|
repoPath := filepath.Join(testReposDir, "language_stats_repo")
|
|
gitRepo, err := OpenRepository(repoPath)
|
|
if !assert.NoError(t, err) {
|
|
t.Fatal()
|
|
}
|
|
defer gitRepo.Close()
|
|
|
|
stats, err := gitRepo.GetLanguageStats("8fee858da5796dfb37704761701bb8e800ad9ef3")
|
|
if !assert.NoError(t, err) {
|
|
t.Fatal()
|
|
}
|
|
|
|
assert.EqualValues(t, map[string]int64{
|
|
"Python": 134,
|
|
"Java": 112,
|
|
}, stats)
|
|
}
|