use Test::More;
use Test::Script 1.10;
use File::Copy;

# don't test on windows, seems to be a problem with Test::Script and Terminals
if ($^O eq 'MSWin32') {
    plan( skip_all => 'skip failing executable tests on windows' )
}
else {
    plan tests => 4;
}


copy ('bin/unding', 'bin/unding.test');

script_compiles('bin/unding.test');

my $pw_repeat = "test\ntest\n";
my $pw        = "test\n";

script_runs(['bin/unding.test', 't/secret.txt'], { stdin => \$pw_repeat }, 'encrypt');
script_runs(['bin/unding.test'],                 { stdin => \$pw },        'decrypt');
script_stdout_is("Hello World!\n",                                         'compare');

unlink 'bin/unding.test';
