File: t1602-delete-spill.sh

package info (click to toggle)
stgit 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,748 kB
  • sloc: python: 10,558; sh: 5,739; lisp: 2,678; makefile: 142; perl: 42
file content (47 lines) | stat: -rwxr-xr-x 1,432 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
test_description='Test "stg delete --spill"'
. ./test-lib.sh

test_expect_success 'Initialize the StGIT repository' '
    stg init
'

test_expect_success 'Create five applied and three unapplied patches' '
    for i in 0 1 2 3 4 5 6 7; do
        echo $i >> foo &&
        stg add foo &&
        git commit -m p$i
    done
    stg uncommit -n 8 &&
    stg pop -n 3
'

test_expect_success 'Try to delete --spill an unapplied patch' '
    command_error stg delete --spill p7 &&
    test "$(echo $(stg series))" = "+ p0 + p1 + p2 + p3 > p4 - p5 - p6 - p7" &&
    test "$(echo $(cat foo))" = "0 1 2 3 4" &&
    test "$(echo $(git diff-files))" = ""
'

test_expect_success 'Try to delete --spill a non-top patch' '
    command_error stg delete --spill p2 &&
    test "$(echo $(stg series))" = "+ p0 + p1 + p2 + p3 > p4 - p5 - p6 - p7" &&
    test "$(echo $(cat foo))" = "0 1 2 3 4" &&
    test "$(echo $(git diff-files))" = ""
'

test_expect_success 'Delete --spill one patch' '
    stg delete --spill p4 &&
    test "$(echo $(stg series))" = "+ p0 + p1 + p2 > p3 - p5 - p6 - p7" &&
    test "$(echo $(cat foo))" = "0 1 2 3 4" &&
    test "$(echo $(git diff-files))" = ""
'

test_expect_success 'Delete --spill several patches' '
    stg delete --spill p2 p3 p1 &&
    test "$(echo $(stg series))" = "> p0 - p5 - p6 - p7" &&
    test "$(echo $(cat foo))" = "0 1 2 3 4" &&
    test "$(echo $(git diff-files))" = ""
'

test_done