(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestRevert(t *testing.T) { |
| 12 | t.Parallel() |
| 13 | repo := createTestRepo(t) |
| 14 | defer cleanupTestRepo(t, repo) |
| 15 | |
| 16 | seedTestRepo(t, repo) |
| 17 | commitID, _ := updateReadme(t, repo, content) |
| 18 | |
| 19 | commit, err := repo.LookupCommit(commitID) |
| 20 | checkFatal(t, err) |
| 21 | |
| 22 | revertOptions, err := DefaultRevertOptions() |
| 23 | checkFatal(t, err) |
| 24 | |
| 25 | err = repo.Revert(commit, &revertOptions) |
| 26 | checkFatal(t, err) |
| 27 | |
| 28 | actualReadmeContents := readReadme(t, repo) |
| 29 | |
| 30 | if actualReadmeContents != expectedRevertedReadmeContents { |
| 31 | t.Fatalf(`README has incorrect contents after revert. Expected: "%v", Actual: "%v"`, |
| 32 | expectedRevertedReadmeContents, actualReadmeContents) |
| 33 | } |
| 34 | |
| 35 | state := repo.State() |
| 36 | if state != RepositoryStateRevert { |
| 37 | t.Fatalf("Incorrect repository state. Expected: %v, Actual: %v", RepositoryStateRevert, state) |
| 38 | } |
| 39 | |
| 40 | err = repo.StateCleanup() |
| 41 | checkFatal(t, err) |
| 42 | |
| 43 | state = repo.State() |
| 44 | if state != RepositoryStateNone { |
| 45 | t.Fatalf("Incorrect repository state. Expected: %v, Actual: %v", RepositoryStateNone, state) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func TestRevertCommit(t *testing.T) { |
| 50 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…