series: Added -g option to start gitk
[guilt.git] / regression / 025-new.sh
blob680f6da9a380b1eb5124ded4acbf78ef6472c409
1 #!/bin/bash
3 # Test the new code
6 source scaffold
7 source generic_test_data
9 function expected_files
11 cat << DONE
12 d .git/patches
13 d .git/patches/master
14 f .git/patches/master/series
15 f .git/patches/master/status
16 f .git/patches/master/modify
17 f .git/patches/master/add
18 f .git/patches/master/remove
19 f .git/patches/master/mode
20 DONE
23 function patch_name_dir
25 echo "aaa"
27 function expected_files_dir
29 expected_files
30 cat << DONE
31 f .git/patches/master/aaa
32 DONE
35 function patch_name_subdir
37 echo "abc/def"
39 function expected_files_subdir
41 expected_files_dir
42 cat << DONE
43 d .git/patches/master/abc
44 f .git/patches/master/abc/def
45 DONE
48 function patch_name_subsubdir
50 echo "foo/bar/patch"
52 function expected_files_subsubdir
54 expected_files_subdir
55 cat << DONE
56 d .git/patches/master/foo
57 d .git/patches/master/foo/bar
58 f .git/patches/master/foo/bar/patch
59 DONE
62 function expected_files_append
64 expected_files_subsubdir
65 echo "f .git/patches/master/append"
68 function expected_files_prepend
70 expected_files_append
71 echo "f .git/patches/master/prepend"
74 # the test itself
75 empty_repo
76 cd $REPODIR
77 guilt-init
79 generic_prepare_for_tests
81 tests="dir subdir subsubdir"
83 for t in $tests; do
84 guilt-new `patch_name_$t`
86 expected_files_$t | verify_repo .git/patches
88 echo -n "[$t] "
89 done
91 guilt-push --all > /dev/null
93 guilt-new append
94 expected_files_append | verify_repo .git/patches
95 echo -n "[append] "
97 guilt-pop -a > /dev/null
99 guilt-new prepend
100 expected_files_prepend | verify_repo .git/patches
101 echo -n "[prepend] "
103 guilt-pop -a > /dev/null
105 guilt-new "white space"
106 echo -n "[whitespace] "
108 shouldfail guilt-new prepend
109 echo -n "[dup] "
111 shouldfail guilt-new /abc
112 echo -n "[abs] "
114 shouldfail guilt-new ./blah
115 echo -n "[prefix-dot] "
117 shouldfail guilt-new ../blah
118 echo -n "[prefix-dotdot] "
120 shouldfail guilt-new abc/./blah
121 echo -n "[infix-dot] "
123 shouldfail guilt-new abc/../blah
124 echo -n "[infix-dotdot] "
126 shouldfail guilt-new abc/.
127 echo -n "[postfix-dot] "
129 shouldfail guilt-new abc/..
130 echo -n "[postfix-dotdot] "
132 shouldfail guilt-new abc/
133 echo -n "[postfix-slash] "
135 complete_test