chiark / gitweb /
test suite: gdr-unprocessable: new test
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 31 Jul 2018 08:13:55 +0000 (09:13 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 31 Jul 2018 08:14:25 +0000 (09:14 +0100)
Test git-debrebase messages about unprocessable commits.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
debian/tests/control
tests/tests/gdr-unprocessable [new file with mode: 0755]

index be2d349..41026cc 100644 (file)
@@ -4,6 +4,7 @@ dgit (6.3~) unstable; urgency=medium
     commits.  Closes:#905003.
   * git-debrebase: new-upstream: Fix error message for new version
     with bad syntax.
+  * git-debrebase test suite: Test messages about unprocessable commits.
 
  --
 
index 8480655..8f7fd7d 100644 (file)
@@ -16,7 +16,7 @@ Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc
 Restrictions: x-dgit-intree-only x-dgit-git-only
 
-Tests: gdr-diverge-nmu gdr-diverge-nmu-dgit gdr-edits gdr-import-dgit gdr-makepatches7 gdr-subcommands
+Tests: gdr-diverge-nmu gdr-diverge-nmu-dgit gdr-edits gdr-import-dgit gdr-makepatches7 gdr-subcommands gdr-unprocessable
 Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, git-debrebase, git-buildpackage, faketime
 
diff --git a/tests/tests/gdr-unprocessable b/tests/tests/gdr-unprocessable
new file mode 100755 (executable)
index 0000000..caa5321
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-dependencies GDR
+
+t-setup-import gdr-convert-gbp
+
+cd $p
+
+t-dgit setup-mergechangelogs
+
+subcmd () {
+       cmd=("$@")
+
+       branch merge 'complex merge'
+       branch origin 'origin commit'
+}
+
+branch () {
+       branch=$1
+       git checkout gdr-unprocessable/$branch
+       msgcore=$2
+       expected-$expected
+}
+
+cmd () {
+       t-git-debrebase "${cmd[@]}"
+}
+
+expected- () {
+       t-expect-fail E:"$(printf "$mfmt" "$msgcore")" \
+       cmd
+}
+
+expected-ok () {
+       f=../out.$branch."${cmd/[^-a-zA-Z//_}"
+       cmd | tee $f
+       for mfmt in "${mfmts[@]}"; do
+               grep "$(printf "$mfmt" "$msgcore")" $f
+       done
+}
+
+mfmt='found unprocessable commit.*%s'
+subcmd
+subcmd quick
+subcmd new-upstream 2.0 upstream/2.0
+subcmd make-patches
+subcmd breakwater
+subcmd anchor
+
+expected=ok
+mfmts=(' Unprocessable (%s)')
+subcmd analyse
+
+mfmts=('branch not in git-debrebase form'
+       'found unprocessable commit, cannot cope: %s')
+subcmd status
+
+t-ok