aboutsummaryrefslogtreecommitdiffstats
path: root/lib/pama/remove_test.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2024-01-31 16:49:28 +0100
committerRobin Jarry <robin@jarry.cc>2024-01-31 16:54:31 +0100
commitb285b894c3de7299452e860fc060b673af279261 (patch)
treed3f834db15ffe749708d734c0b6cd0645de7aabf /lib/pama/remove_test.go
parentf16b33f752bbc3086d08ba8fde034de48ab1c6d6 (diff)
downloadaerc-b285b894c3de7299452e860fc060b673af279261.tar.gz
commands: rename patch remove to patch drop
Rename the :patch remove command to :patch drop to better express the this operation is the counter-part to :patch apply. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/pama/remove_test.go')
-rw-r--r--lib/pama/remove_test.go85
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/pama/remove_test.go b/lib/pama/remove_test.go
deleted file mode 100644
index c9ce6c65..00000000
--- a/lib/pama/remove_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package pama_test
-
-import (
- "reflect"
- "testing"
-
- "git.sr.ht/~rjarry/aerc/lib/pama"
- "git.sr.ht/~rjarry/aerc/lib/pama/models"
-)
-
-func TestPatchmgmt_Remove(t *testing.T) {
- setup := func(p models.Project) (pama.PatchManager, models.RevisionController, models.PersistentStorer) {
- return newTestManager(
- []string{"0", "1", "2", "3", "4", "5"},
- []string{"0", "a", "b", "c", "d", "f"},
- map[string]models.Project{p.Name: p}, p.Name,
- )
- }
-
- tests := []struct {
- name string
- remove string
- commits []models.Commit
- want []models.Commit
- }{
- {
- name: "remove only patch",
- remove: "patch1",
- commits: []models.Commit{
- newCommit("1", "a", "patch1"),
- },
- want: []models.Commit{},
- },
- {
- name: "remove second one of two patch",
- remove: "patch2",
- commits: []models.Commit{
- newCommit("1", "a", "patch1"),
- newCommit("2", "b", "patch2"),
- },
- want: []models.Commit{
- newCommit("1", "a", "patch1"),
- },
- },
- {
- name: "remove first one of two patch",
- remove: "patch1",
- commits: []models.Commit{
- newCommit("1", "a", "patch1"),
- newCommit("2", "b", "patch2"),
- },
- want: []models.Commit{
- newCommit("2_new", "b", "patch2"),
- },
- },
- }
-
- for _, test := range tests {
- p := models.Project{
- Name: "project1",
- Commits: test.commits,
- Base: newCommit("0", "0", ""),
- }
- mgr, rc, _ := setup(p)
-
- err := mgr.RemovePatch(test.remove)
- if err != nil {
- t.Errorf("test '%s' failed. %v", test.name, err)
- }
-
- q, _ := mgr.CurrentProject()
- if !reflect.DeepEqual(q.Commits, test.want) {
- t.Errorf("test '%s' failed. Commits don't match: "+
- "got %v, but wanted %v", test.name, q.Commits,
- test.want)
- }
-
- if len(test.want) > 0 {
- last := test.want[len(test.want)-1]
- if !rc.Exists(last.ID) {
- t.Errorf("test '%s' failed. Could not find last commits: %v", test.name, last)
- }
- }
- }
-}