Verified Commit 8b355f61 authored by Paul Gevers's avatar Paul Gevers
Browse files

Prepend debian/tests/control to the output if it exists

Closes: #908272
parent 7471d7eb
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -21,9 +21,11 @@ produces not output.

# COMBINING AUTO-GENERATED TESTS WITH MANUALLY SPECIFIED ONES

If `debian/tests/control.autodep8` exists, autodep8 will prepend the contents
of that file to its own output. In that case, autodep8 will exit with a status
of 0 even if no known package type is detected.
If `debian/tests/control` exists, autodep8 will prepend the contents of that
file to its own output. In that case, autodep8 will exit with a status of 0
even if no known package type is detected. The same applies for
`debian/tests/control.autodep8`, but the use of that file is deprecated because
the test dependencies defined there aren't processed by dpkg-source.

# EXAMPLES OF PRODUCED TEST SUITES

+9 −0
Original line number Diff line number Diff line
@@ -40,6 +40,15 @@ if [ -f debian/tests/control.autodep8 ]; then

  rc=0 # will now exit successfully even if we can't detect a package type.
fi
if [ -f debian/tests/control ]; then
  cat debian/tests/control

  # 2 newlines to cope with control having no trailing newline
  echo
  echo

  rc=0 # will now exit successfully even if we can't detect a package type.
fi


for support_dir in \
+9 −1
Original line number Diff line number Diff line
@@ -5,11 +5,19 @@ test_no_detection() {
  assertEquals 1 "$exitstatus"
}

test_append_to_control() {
  has debian/tests/control '# BEFORE'
  run autodep8
  assertEquals 0 "$exitstatus"
  assertTrue 'output prepended to contents of debian/tests/control' "grep '^# BEFORE' stdout"
  assertTrue 'empty line after contents of debian/tests/control' "grep '^\$' stdout"
}

test_append_to_control_autodep8() {
  has debian/tests/control.autodep8 '# BEFORE'
  run autodep8
  assertEquals 0 "$exitstatus"
  assertTrue 'output appended to contents of debian/tests/control.autodep8' "grep '^# BEFORE' stdout"
  assertTrue 'output prepended to contents of debian/tests/control.autodep8' "grep '^# BEFORE' stdout"
  assertTrue 'empty line after contents of debian/tests/control.autodep8' "grep '^\$' stdout"
}