### ----------------------------------------------------
### -- Karabiner::CompModGenerator
### -- Licenses: Artistic-2.0
### -- Authors: Steve Dondley
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use Karabiner::CompModGenerator;


plan 5;


"ActivateApps.json".IO.unlink;


# 1 - check binary fails without argument
my $proc = run('bin/kcmg');
isnt $proc.exitcode, 0, 'fails without argument';

# 2
isnt (run 'bin/kcmg', '--', 't/blah.cfg').exitcode, 0, 'detects non-existent config file'; 

# 3
run 'bin/kcmg', '--', 't/data/ActivateApps.cfg';
is "ActivateApps.json".IO.f, True, 'creates output file';

# 4
my $file_contents = "ActivateApps.json".IO.slurp;
is $file_contents ~~ /command/, 'command', 'puts content into file';

"ActivateApps.json".IO.unlink;

# 5
dies-ok { run 'bin/kcmg', '--', 't/data/NoTemplate.cfg' }, 'detect when template does not exist and dies.';


done-testing;


