MCPcopy Create free account
hub / github.com/alibaba/open-code-review / TestResolveInput_Range

Function TestResolveInput_Range

internal/diff/git_resolve_test.go:50–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestResolveInput_Range(t *testing.T) {
51 repo := initBareRepo(t)
52 writeCommit(t, repo, "a.txt", "one\n", "base")
53 base := gitOut(t, repo, "rev-parse", "HEAD")
54 // Capture the default branch name (master or main, git-version dependent).
55 baseBranch := gitOut(t, repo, "rev-parse", "--abbrev-ref", "HEAD")
56 runGitTest(t, repo, "checkout", "-q", "-b", "feature")
57 writeCommit(t, repo, "a.txt", "one\ntwo\n", "feature change")
58 head := gitOut(t, repo, "rev-parse", "HEAD")
59
60 p := NewProvider(repo, baseBranch, "feature", nil)
61 got := p.ResolveInput(context.Background())
62 if got.ResolvedBase != base {
63 t.Errorf("ResolvedBase = %q, want merge-base %q", got.ResolvedBase, base)
64 }
65 if got.ResolvedHead != head {
66 t.Errorf("ResolvedHead = %q, want %q", got.ResolvedHead, head)
67 }
68 if want := base + ".." + head; got.ExactRange != want {
69 t.Errorf("ExactRange = %q, want %q", got.ExactRange, want)
70 }
71}
72
73func TestResolveInput_SingleParentCommit(t *testing.T) {
74 repo := initBareRepo(t)

Callers

nothing calls this directly

Calls 6

ResolveInputMethod · 0.95
initBareRepoFunction · 0.85
writeCommitFunction · 0.85
gitOutFunction · 0.85
runGitTestFunction · 0.85
NewProviderFunction · 0.70

Tested by

no test coverage detected