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

Function TestResolveInput_Range

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

Source from the content-addressed store, hash-verified

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