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
5//go:build !gogit
6// +build !gogit
7
8package git
9
10import (
11	"path/filepath"
12	"testing"
13
14	"github.com/stretchr/testify/assert"
15)
16
17func TestRepository_GetLanguageStats(t *testing.T) {
18	repoPath := filepath.Join(testReposDir, "language_stats_repo")
19	gitRepo, err := OpenRepository(repoPath)
20	if !assert.NoError(t, err) {
21		t.Fatal()
22	}
23	defer gitRepo.Close()
24
25	stats, err := gitRepo.GetLanguageStats("8fee858da5796dfb37704761701bb8e800ad9ef3")
26	if !assert.NoError(t, err) {
27		t.Fatal()
28	}
29
30	assert.EqualValues(t, map[string]int64{
31		"Python": 134,
32		"Java":   112,
33	}, stats)
34}
35