File: add_test.go

package info (click to toggle)
gitbatch 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 644 kB
  • sloc: makefile: 5; sh: 1
file content (70 lines) | stat: -rw-r--r-- 1,306 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package command

import (
	"testing"

	"github.com/isacikgoz/gitbatch/internal/git"
	"github.com/stretchr/testify/require"
)

var (
	testAddopt1 = &AddOptions{}
)

func TestAddAll(t *testing.T) {
	th := git.InitTestRepositoryFromLocal(t)
	defer th.CleanUp(t)

	_, err := testFile(th.RepoPath, "file")
	require.NoError(t, err)

	var tests = []struct {
		inp1 *git.Repository
		inp2 *AddOptions
	}{
		{th.Repository, testAddopt1},
	}
	for _, test := range tests {
		err := AddAll(test.inp1, test.inp2)
		require.NoError(t, err)
	}
}

func TestAddWithGit(t *testing.T) {
	th := git.InitTestRepositoryFromLocal(t)
	defer th.CleanUp(t)

	f, err := testFile(th.RepoPath, "file")
	require.NoError(t, err)

	var tests = []struct {
		inp1 *git.Repository
		inp2 *git.File
		inp3 *AddOptions
	}{
		{th.Repository, f, testAddopt1},
	}
	for _, test := range tests {
		err := addWithGit(test.inp1, test.inp2, test.inp3)
		require.NoError(t, err)
	}
}

func TestAddWithGoGit(t *testing.T) {
	th := git.InitTestRepositoryFromLocal(t)
	defer th.CleanUp(t)

	f, err := testFile(th.RepoPath, "file")
	require.NoError(t, err)

	var tests = []struct {
		inp1 *git.Repository
		inp2 *git.File
	}{
		{th.Repository, f},
	}
	for _, test := range tests {
		err := addWithGoGit(test.inp1, test.inp2)
		require.NoError(t, err)
	}
}