Don't use test_expect_failure for tests that are supposed to work
[stgit] / t / t2700-refresh.sh
CommitLineData
38baedf2
DK
1#!/bin/sh
2
3test_description='Run "stg refresh"'
4
5. ./test-lib.sh
6
7test_expect_success 'Initialize StGit stack' '
8 stg init &&
9 echo expected.txt >> .git/info/exclude &&
10 echo patches.txt >> .git/info/exclude &&
11 stg new p0 -m "base" &&
12 for i in 1 2 3; do
13 echo base >> foo$i.txt &&
14 git add foo$i.txt
15 done
16 stg refresh &&
17 for i in 1 2 3; do
18 stg new p$i -m "foo $i" &&
19 echo "foo $i" >> foo$i.txt &&
20 stg refresh
21 done
22'
23
24cat > expected.txt <<EOF
25p0
26p3
27EOF
28test_expect_success 'Refresh top patch' '
29 echo bar 3 >> foo3.txt &&
30 stg refresh &&
31 stg status &&
32 test -z "$(stg status)" &&
33 stg patches foo3.txt > patches.txt &&
34 diff -u expected.txt patches.txt
35'
36
37cat > expected.txt <<EOF
38p0
39p2
40EOF
41test_expect_success 'Refresh middle patch' '
42 stg status &&
43 echo bar 2 >> foo2.txt &&
44 stg refresh -p p2 &&
45 stg status &&
46 test -z "$(stg status)" &&
47 stg patches foo2.txt > patches.txt &&
48 diff -u expected.txt patches.txt
49'
50
51cat > expected.txt <<EOF
52p0
53p1
54EOF
55test_expect_success 'Refresh bottom patch' '
56 stg status &&
57 echo bar 1 >> foo1.txt &&
58 stg refresh -p p1 &&
59 stg status &&
60 test -z "$(stg status)" &&
61 stg patches foo1.txt > patches.txt &&
62 diff -u expected.txt patches.txt
63'
64
65test_done