From edb8a963113044270afa44e89f15cc51378ae0f9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 6 May 2010 07:56:07 +0200 Subject: Use TAP + prove for tets --- Makefile | 4 ++-- test/00-compile.t | 8 ++++++++ test/10-pod-coverage.t | 8 ++++++++ test/50-apt-why.t | 24 ++++++++++++++++++++++++ test/main | 8 -------- 5 files changed, 42 insertions(+), 10 deletions(-) create mode 100755 test/00-compile.t create mode 100755 test/10-pod-coverage.t create mode 100755 test/50-apt-why.t delete mode 100755 test/main diff --git a/Makefile b/Makefile index 7cd4733..49bc40d 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,8 @@ build/apt-why.1: bin/apt-why mkdir -p build pod2man $< > $@ -test: test/main - sh $< +test: + prove test install: build/apt-why.1 mkdir -p $(prefix)/bin $(prefix)/share/man/man1 diff --git a/test/00-compile.t b/test/00-compile.t new file mode 100755 index 0000000..e4e0b2d --- /dev/null +++ b/test/00-compile.t @@ -0,0 +1,8 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; +use Test::More; +use Test::Compile; + +all_pl_files_ok('bin/apt-why'); diff --git a/test/10-pod-coverage.t b/test/10-pod-coverage.t new file mode 100755 index 0000000..e8a18ea --- /dev/null +++ b/test/10-pod-coverage.t @@ -0,0 +1,8 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; +use Test::More; +use Test::Pod; + +all_pod_files_ok('bin/apt-why'); diff --git a/test/50-apt-why.t b/test/50-apt-why.t new file mode 100755 index 0000000..2e2b934 --- /dev/null +++ b/test/50-apt-why.t @@ -0,0 +1,24 @@ +#!/usr/bin/env perl +## Copyright © 2010 by Daniel Friesel +## License: WTFPL +use strict; +use warnings; +use 5.010; +use Test::Command tests => 6; + +my $aw = 'bin/apt-why'; + +my $re_usage = + qr{Usage: \S*apt-why \[options\] ; see \S*apt-why --help}; + +my $cmd = Test::Command->new(cmd => "$aw"); + +$cmd->exit_isnt_num(0); +$cmd->stdout_is_eq(''); +$cmd->stderr_like($re_usage); + +$cmd = Test::Command->new(cmd => "$aw does-not-exist"); + +$cmd->exit_isnt_num(0); +$cmd->stdout_is_eq(''); +$cmd->stderr_is_eq("No such package: does-not-exist\n"); diff --git a/test/main b/test/main deleted file mode 100755 index 48a30da..0000000 --- a/test/main +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -e - -echo "# Documentation" -podchecker -warnings -warnings bin/* - -echo "# Invalid invocation / package name" -! bin/apt-why -! bin/apt-why ntA-a54Ertn5 -- cgit v1.2.3