### ----------------------------------------------------
### -- Needle::Compile
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: xt/01-json.rakutest
### ----------------------------------------------------
BEGIN %*ENV<RAKU_TEST_DIE_ON_FAIL> = 1;
use Test;
use Needle::Compile "Type";

use JSON::Fast;
my %meta := from-json $*PROGRAM.parent.parent.add('META6.json').slurp;

# Ways to check "auth"
my @auth =
  "jp:auth",
  "auth" but Type<json-path>,
  "json-path" => "auth",
  '{ |jp("auth") }',
  "code" => 'jp("auth").Slip',
;

plan +@auth;

for @auth {
    subtest "JSON path: auth" => {
        plan 2;

        my &auth := compile-needle($_);
        isa-ok &auth, Callable, "Testing $_.raku()";

        is-deeply auth(%meta), ("zef:lizmat",).Slip, 'produced ok';
    }
}

# vim: expandtab shiftwidth=4


