1.1 test.pl
 1use strict;
 2use warnings;
 3
 4# Verify that gen outputs the same thing as get
 5if (-t STDIN) {
 6	$ENV{'HASLODIR'} = '.';
 7	do {
 8		local $SIG{__DIE__} = sub {
 9			die if system q(echo y | haslo del tmp 2>/dev/null);
10		};
11		my $gen = qx(./haslo gen tmp);
12		die if $?;
13		my $get = qx(./haslo get tmp);
14		die if $?;
15		die "$gen ne $get" if $gen ne $get;
16	};
17	die if system q(echo y | haslo del tmp 2>/dev/null);
18} else {
19	print "stdin not a terminal, skipping test\n";
20}