diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-05-06 07:56:07 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-05-06 07:56:07 +0200 |
commit | edb8a963113044270afa44e89f15cc51378ae0f9 (patch) | |
tree | c47a020684cabc8a513642ce4dba58a1d7afa83c | |
parent | 36b1bdf0f02c3bf6c38b8f7c6dce10b684ad5537 (diff) |
Use TAP + prove for tets
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | test/00-compile.t | 8 | ||||
-rwxr-xr-x | test/10-pod-coverage.t | 8 | ||||
-rwxr-xr-x | test/50-apt-why.t | 24 | ||||
-rwxr-xr-x | test/main | 8 |
5 files changed, 42 insertions, 10 deletions
@@ -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 <derf@derf.homelinux.org> +## License: WTFPL <http://sam.zoy.org/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\] <package>; 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 |