Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
package app |
| 2 |
|
| 3 |
import ( |
| 4 |
"os" |
| 5 |
"testing" |
| 6 |
|
| 7 |
"github.com/isacikgoz/gitbatch/internal/git" |
| 8 |
"github.com/stretchr/testify/require" |
| 9 |
) |
| 10 |
|
| 11 |
func TestOverrideConfig(t *testing.T) { |
| 12 |
config1 := &Config{ |
| 13 |
Directories: []string{}, |
| 14 |
LogLevel: "info", |
| 15 |
Depth: 1, |
| 16 |
QuickMode: false, |
| 17 |
Mode: "fetch", |
| 18 |
} |
| 19 |
config2 := &Config{ |
| 20 |
Directories: []string{string(os.PathSeparator) + "tmp"}, |
| 21 |
LogLevel: "error", |
| 22 |
Depth: 1, |
| 23 |
QuickMode: true, |
| 24 |
Mode: "pull", |
| 25 |
} |
| 26 |
|
| 27 |
var tests = []struct { |
| 28 |
inp1 *Config |
| 29 |
inp2 *Config |
| 30 |
expected *Config |
| 31 |
}{ |
| 32 |
{config1, config2, config1}, |
| 33 |
} |
| 34 |
for _, test := range tests { |
| 35 |
output := overrideConfig(test.inp1, test.inp2) |
| 36 |
require.Equal(t, test.expected, output) |
| 37 |
require.Equal(t, test.inp2.Mode, output.Mode) |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
func TestExecQuickMode(t *testing.T) { |
| 42 |
th := git.InitTestRepositoryFromLocal(t) |
| 43 |
defer th.CleanUp(t) |
| 44 |
|
| 45 |
var tests = []struct { |
| 46 |
inp1 []string |
| 47 |
}{ |
| 48 |
{[]string{th.BasicRepoPath()}}, |
| 49 |
} |
| 50 |
a := App{ |
| 51 |
Config: &Config{ |
| 52 |
Mode: "fetch", |
| 53 |
}, |
| 54 |
} |
| 55 |
for _, test := range tests { |
| 56 |
err := a.execQuickMode(test.inp1) |
| 57 |
require.NoError(t, err) |
| 58 |
} |
| 59 |
} |