### ----------------------------------------------------
### -- Grok
### -- Licenses: Artistic-2.0
### -- Authors: Jeff Armstrong
### -- File: xt/81-grok-compound-types.rakutest
### ----------------------------------------------------
use v6;

use Test;
use Test::Output;

plan 36;

use lib $?FILE.IO.parent;
use TestUtils;

use Grok;

for (
  Array                                ,
  Associative                          ,
  Bag                                  ,
  BagHash                              ,
  Baggy                                ,
  Blob                                 ,
  Buf                                  ,
  Capture                              ,
  Enumeration                          ,
  Hash                                 ,
  Iterable                             ,
  Iterator                             ,
  List                                 ,
  Map                                  ,
  Mix                                  ,
  MixHash                              ,
  Mixy                                 ,
  NFC                                  ,
  NFD                                  ,
  NFKC                                 ,
  NFKD                                 ,
  Pair                                 ,
  Positional                           ,
  PositionalBindFailover               ,
  PseudoStash                          ,
  QuantHash                            ,
  Range                                ,
  Seq                                  ,
  Sequence                             ,
  Set                                  ,
  SetHash                              ,
  Setty                                ,
  Slip                                 ,
  Stash                                ,
  Uni                                  ,
  utf8                                 ,
) -> $thing {

  my $file = get-output-name($thing).IO;

  # Generate reference output
  $file.spurt( output-from({grok($thing)}).&purified )
    unless $file.e;

  # Test reference output
  is  output-from( { grok($thing) } ).&purified,
      $file.IO.slurp,
      $thing.^name;

}

say 'done';

done-testing;


