Package: src:clitest
Severity: wishlist
Tags: patch

Hi,

I just came across clitest and I found it to be an amazing tool to write
tests with, but it is a shame that clitest itself is not being tested.
:-)

The attached patch does that by reusing the examples that come with
clitest itself, except the ones that hits the network. I can commit
directly to collab-maint if you prefer.

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.5.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- 
Antonio Terceiro <[email protected]>
From 79c6d0157a374503990d12f32d70b0c4d617209a Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <[email protected]>
Date: Tue, 7 Jun 2016 10:29:23 -0300
Subject: [PATCH] Add a simple test suite

It will run both during package build and on CI/autopkgtest
---
 debian/rules             |  3 +++
 debian/tests/control     |  1 +
 debian/tests/smoke-tests | 15 +++++++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/smoke-tests

diff --git a/debian/rules b/debian/rules
index ed58acc..cad729e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,3 +3,6 @@
 
 %:
 	dh $@
+
+override_dh_auto_test:
+	PATH=$(CURDIR):$(PATH) debian/tests/smoke-tests
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..894bbbb
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1 @@
+Tests: smoke-tests
diff --git a/debian/tests/smoke-tests b/debian/tests/smoke-tests
new file mode 100755
index 0000000..cb79c77
--- /dev/null
+++ b/debian/tests/smoke-tests
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+exec 2>&1
+set -ex
+
+# these should pass
+clitest examples/cut.txt
+clitest --prefix tab examples/cut.md
+clitest examples/hello-world.txt
+clitest examples/intro.txt
+
+# this should fail
+rc=0
+clitest examples/will-fail.txt || rc=$?
+test $rc -ne 0
-- 
2.8.1

Attachment: signature.asc
Description: PGP signature

Reply via email to