### ----------------------------------------------------
### -- Collection
### -- Licenses: Artistic-2.0
### -- Authors: Richard Hainsworth, aka finanalyst
### -- File: xt/60-preserve-state.rakutest
### ----------------------------------------------------
use v6.d;
use Test;
use Test::Output;
use File::Directory::Tree;

use Collection;
constant TMP = 'xt/test-dir';
constant MODE = 'test-mode';
constant PLUGS = "{ MODE }/plugins";
constant CONFS = "{ MODE }/configs";
constant TEMPLATES = "{ MODE }/templates";
constant OUTPUT = "{ MODE }/html";
constant REPORT = "{ MODE }/reports";
constant ASSETS = "assets";

plan 7;
my $rv;

bail-out "{ TMP } and { TMP }/{ REPORT } must exist. Have report-completion tests been run?"
unless TMP.IO.d and "{ TMP }/{ REPORT }".IO.d;

chdir TMP;
"{MODE}/{ Collection::PRESERVE }".IO.unlink #eliminate if exists
        if "{MODE}/{ Collection::PRESERVE }".IO.e;
skip 'Archiving disabled', 7;

#stderr-like {
#        $rv = collect( MODE, :after<mode>, :recompile, :!no-preserve-state ) ;
#        },
#        / 'Could not recover the archive' /,
#        'detects the absence of preserved state';
#is $rv[0][2], True, 'Full-render turned on';
#
#rmtree OUTPUT;
#stderr-like { $rv = collect( MODE, :after<all>, :without-processing) },
#         / 'Cannot continue without processing' /,
#        'traps no html output';
#
#$rv = collect( :after<report>, :!no-status, :!no-preserve-state);
#ok "{MODE}/{ Collection::PRESERVE }".IO ~~ :e & :f, 'got preserve state archive';
#my ($ok, %processed, %symbols) := restore-processed-state( MODE , :!no-status );
#ok $ok, 'restoration was good';
#isa-ok %processed<file-a>, 'PodFile', 'processed seems to have expected data';
#isa-ok %symbols, 'Hash', 'symbols seems OK';

done-testing;


