diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2019-06-14 05:51:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-14 05:51:32 +0200 |
commit | 26b54e8c7bc9678bf87c6ba298edf38d34b51d25 (patch) | |
tree | 87d02875aa79bb1e6372c21d20a1afed0844ab41 /_examples/common_test.go | |
parent | 6142bc316a5ade48044c95f5be92872e7e00b7d6 (diff) | |
parent | 56af959fab24bced5dd9da383d6b12f125526017 (diff) | |
download | go-git-26b54e8c7bc9678bf87c6ba298edf38d34b51d25.tar.gz |
Merge pull request #1096 from dpordomingo/merge-base-command
Add merge base command
Diffstat (limited to '_examples/common_test.go')
-rw-r--r-- | _examples/common_test.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/_examples/common_test.go b/_examples/common_test.go index 47463a1..89d49a3 100644 --- a/_examples/common_test.go +++ b/_examples/common_test.go @@ -29,6 +29,7 @@ var args = map[string][]string{ "tag": {cloneRepository(defaultURL, tempFolder())}, "pull": {createRepositoryWithRemote(tempFolder(), defaultURL)}, "ls": {cloneRepository(defaultURL, tempFolder()), "HEAD", "vendor"}, + "merge_base": {cloneRepository(defaultURL, tempFolder()), "--is-ancestor", "HEAD~3", "HEAD^"}, } var ignored = map[string]bool{} @@ -50,14 +51,15 @@ func TestExamples(t *testing.T) { } for _, example := range examples { - _, name := filepath.Split(filepath.Dir(example)) + dir := filepath.Dir(example) + _, name := filepath.Split(dir) if ignored[name] { continue } t.Run(name, func(t *testing.T) { - testExample(t, name, example) + testExample(t, name, dir) }) } } @@ -135,10 +137,9 @@ func addRemote(local, remote string) { CheckIfError(err) } -func testExample(t *testing.T, name, example string) { - cmd := exec.Command("go", append([]string{ - "run", filepath.Join(example), - }, args[name]...)...) +func testExample(t *testing.T, name, dir string) { + arguments := append([]string{"run", dir}, args[name]...) + cmd := exec.Command("go", arguments...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr |