### ----------------------------------------------------
### -- Red
### -- Licenses: Artistic-2.0
### -- Authors: Fernando Correa de Oliveira
### -- File: t/78-datetime-function.rakutest
### ----------------------------------------------------
#!/usr/bin/env raku

use lib "t/lib";

use Test;

use DB;
use Red:api<2>;

model Blx {
  has DateTime $.a is column;
  has Date     $.b is column;
}

my $*RED-DEBUG          = $_ with %*ENV<RED_DEBUG>;
my $*RED-DEBUG-RESPONSE = $_ with %*ENV<RED_DEBUG_RESPONSE>;
my @conf                = (%*ENV<RED_DATABASE> // "SQLite").split(" ");
my $driver              = @conf.shift;
my $*RED-DB             = database $driver, |%( @conf.map: { do given .split: "=" { .[0] => val .[1] } } );

my $*RED-FALLBACK = False;

schema(Blx).drop.create;

lives-ok {
  .say for Blx.^all.map(*.a.year)
}

lives-ok {
  .say for Blx.^all.map(*.b.year)
}

done-testing


