diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | test/customlist | 4 | ||||
-rw-r--r-- | test/fail.gif | 0 | ||||
-rw-r--r-- | test/fail.jpg | 0 | ||||
-rw-r--r-- | test/fail.png | 0 | ||||
-rw-r--r-- | test/fail.pnm | 0 | ||||
-rw-r--r-- | test/list | 5 | ||||
-rw-r--r-- | test/ok.gif | bin | 0 -> 953 bytes | |||
-rw-r--r-- | test/ok.jpg | bin | 0 -> 354 bytes | |||
-rw-r--r-- | test/ok.png | bin | 0 -> 403 bytes | |||
-rw-r--r-- | test/ok.pnm | bin | 0 -> 269 bytes | |||
-rw-r--r-- | test/test.pl | 52 | ||||
-rw-r--r-- | test/warning-no-loader | 4 |
13 files changed, 71 insertions, 2 deletions
@@ -1,8 +1,12 @@ include config.mk -default: +all: @${MAKE} -C src +test: all + mandoc -Tlint man/* + perl test/test.pl ${PACKAGE} ${VERSION} + install: install-man install-doc install-bin install-font install-img install-man: @@ -59,5 +63,5 @@ uninstall: clean: @${MAKE} -C src clean -.PHONY: default install uninstall clean install-man install-doc install-bin \ +.PHONY: all test install uninstall clean install-man install-doc install-bin \ install-font install-img diff --git a/test/customlist b/test/customlist new file mode 100644 index 0000000..3595be4 --- /dev/null +++ b/test/customlist @@ -0,0 +1,4 @@ +test/ok.gif; 16; 4; list; ok.gif; 256; 953; gif; 0; 16 +test/ok.jpg; 16; 4; list; ok.jpg; 256; 354; jpeg; 0; 16 +test/ok.png; 16; 4; list; ok.png; 256; 403; png; 0; 16 +test/ok.pnm; 16; 4; list; ok.pnm; 256; 269; pnm; 0; 16 diff --git a/test/fail.gif b/test/fail.gif new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fail.gif diff --git a/test/fail.jpg b/test/fail.jpg new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fail.jpg diff --git a/test/fail.png b/test/fail.png new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fail.png diff --git a/test/fail.pnm b/test/fail.pnm new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fail.pnm diff --git a/test/list b/test/list new file mode 100644 index 0000000..036b0f4 --- /dev/null +++ b/test/list @@ -0,0 +1,5 @@ +NUM FORMAT WIDTH HEIGHT PIXELS SIZE(bytes) ALPHA FILENAME +1 gif 16 16 256 953 - test/ok.gif +2 jpeg 16 16 256 354 - test/ok.jpg +3 png 16 16 256 403 X test/ok.png +4 pnm 16 16 256 269 - test/ok.pnm diff --git a/test/ok.gif b/test/ok.gif Binary files differnew file mode 100644 index 0000000..613264e --- /dev/null +++ b/test/ok.gif diff --git a/test/ok.jpg b/test/ok.jpg Binary files differnew file mode 100644 index 0000000..060565e --- /dev/null +++ b/test/ok.jpg diff --git a/test/ok.png b/test/ok.png Binary files differnew file mode 100644 index 0000000..2f06506 --- /dev/null +++ b/test/ok.png diff --git a/test/ok.pnm b/test/ok.pnm Binary files differnew file mode 100644 index 0000000..d62d062 --- /dev/null +++ b/test/ok.pnm diff --git a/test/test.pl b/test/test.pl new file mode 100644 index 0000000..69ba824 --- /dev/null +++ b/test/test.pl @@ -0,0 +1,52 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.010; +use Test::Command tests => 18; + +my $feh = 'src/feh'; +my $images = 'test/ok.* test/fail.*'; + +my ($feh_name, $feh_version) = @ARGV; + +my $re_warning = + qr{${feh_name} WARNING: test/fail\.... \- No Imlib2 loader for that file format\n}; +my $re_loadable = qr{test/ok\....}; +my $re_unloadable = qr{test/fail\....}; + +my $cmd = Test::Command->new(cmd => $feh); + +# Insufficient Arguments -> Usage should return failure +$cmd->exit_is_num(1, 'missing arguments return 1'); +$cmd->stdout_is_eq('', 'missing arguments print usage (!stdout)'); +$cmd->stderr_is_eq(<<"EOF", 'missing arguments print usage (stderr)'); +${feh_name} - No loadable images specified. +Use ${feh_name} --help for detailed usage information +EOF + +# feh --version / feh -v +$cmd = Test::Command->new(cmd => "$feh --version"); +$cmd->exit_is_num(0); +$cmd->stdout_is_eq("${feh_name} version ${feh_version}\n"); +$cmd->stderr_is_eq(''); + +$cmd = Test::Command->new(cmd => "$feh --loadable $images"); +$cmd->exit_is_num(0); +$cmd->stdout_like($re_loadable); +$cmd->stderr_is_eq(''); + +$cmd = Test::Command->new(cmd => "$feh --unloadable $images"); +$cmd->exit_is_num(0); +$cmd->stdout_like($re_unloadable); +$cmd->stderr_is_eq(''); + +$cmd = Test::Command->new(cmd => "$feh --list $images"); +$cmd->exit_is_num(0); +$cmd->stdout_is_file('test/list'); +$cmd->stderr_like($re_warning); + +$cmd = Test::Command->new(cmd => "$feh --customlist '%f; %h; %l; %m; %n; %p; " + . "%s; %t; %u; %w' $images"); +$cmd->exit_is_num(0); +$cmd->stdout_is_file('test/customlist'); +$cmd->stderr_like($re_warning); diff --git a/test/warning-no-loader b/test/warning-no-loader new file mode 100644 index 0000000..0ab95a5 --- /dev/null +++ b/test/warning-no-loader @@ -0,0 +1,4 @@ +feh WARNING: test/fail.pnm - No Imlib2 loader for that file format +feh WARNING: test/fail.png - No Imlib2 loader for that file format +feh WARNING: test/fail.jpg - No Imlib2 loader for that file format +feh WARNING: test/fail.gif - No Imlib2 loader for that file format |