Skip to content

Commit

Permalink
Add a unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
matejrisek committed May 8, 2023
1 parent 72ec001 commit c1e5037
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions submodule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import (
"path/filepath"
"testing"

"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/storage/memory"

fixtures "github.com/go-git/go-git-fixtures/v4"
. "gopkg.in/check.v1"
Expand Down Expand Up @@ -233,3 +236,26 @@ func (s *SubmoduleSuite) TestSubmodulesUpdateContext(c *C) {
err = sm.UpdateContext(ctx, &SubmoduleUpdateOptions{Init: true})
c.Assert(err, NotNil)
}

func (s *SubmoduleSuite) TestSubmoduleParseScp(c *C) {
repo := &Repository{
Storer: memory.NewStorage(),
wt: memfs.New(),
}
worktree := &Worktree{
Filesystem: memfs.New(),
r: repo,
}
submodule := &Submodule{
initialized: true,
c: nil,
w: worktree,
}

submodule.c = &config.Submodule{
URL: "git@github.com:username/submodule_repo",
}

_, err := submodule.Repository()
c.Assert(err, IsNil)
}

0 comments on commit c1e5037

Please sign in to comment.