]>
Dogcows Code - chaz/graphql-client/blob - t/cli.t
9 use GraphQL
::Client
::CLI
;
11 subtest
'get_options' => sub {
13 format
=> 'json:pretty',
16 operation_name
=> undef,
26 my $r = GraphQL
::Client
::CLI-
>_get_options(qw{--url foo --query bar});
27 is_deeply
($r, $expected, '--url and --query set options') or diag explain
$r;
29 $r = GraphQL
::Client
::CLI-
>_get_options(qw{foo --query bar});
30 is_deeply
($r, $expected, '--url is optional') or diag explain
$r;
32 $r = GraphQL
::Client
::CLI-
>_get_options(qw{foo bar});
33 is_deeply
($r, $expected, '--query is also optional') or diag explain
$r;
36 subtest
'expand_vars' => sub {
37 my $r = GraphQL
::Client
::CLI
::_expand_vars
({
40 'arr1[1].tut' => 'whatever',
41 'arr2[1][0].meh'=> 3.1415,
64 }, 'expand all the vars') or diag explain
$r;
67 GraphQL
::Client
::CLI
::_expand_vars
({
71 } qr/^Conflicting keys/, 'throw if conflict between hash and array';
74 GraphQL
::Client
::CLI
::_expand_vars
({
78 } qr/^Conflicting keys/, 'throw if conflict between hash and scalar';
This page took 0.041409 seconds and 4 git commands to generate.