X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fgraphql-client;a=blobdiff_plain;f=t%2Fcli.t;fp=t%2Fcli.t;h=2fa501ceac917a4f2dc88bac39e0d127ea579208;hp=2ae980e4f0a76e55785ba01d8da9fd56ff1bd404;hb=e2f95e02b06704ec9894a1e981263c39354f6559;hpb=731d4977250fa7fec132712d1dfe06dc8d3332e2 diff --git a/t/cli.t b/t/cli.t index 2ae980e..2fa501c 100755 --- a/t/cli.t +++ b/t/cli.t @@ -8,6 +8,8 @@ use Test::More; use GraphQL::Client::CLI; +delete $ENV{GRAPHQL_CLIENT_OPTIONS}; + subtest 'get_options' => sub { my $expected = { format => 'json:pretty', @@ -31,6 +33,14 @@ subtest 'get_options' => sub { $r = GraphQL::Client::CLI->_get_options(qw{foo bar}); is_deeply($r, $expected, '--query is also optional') or diag explain $r; + + { + local $ENV{GRAPHQL_CLIENT_OPTIONS} = '--url asdf --query "baz qux" --unpack'; + local $expected->{query} = 'baz qux'; + local $expected->{unpack} = 1; + $r = GraphQL::Client::CLI->_get_options(qw{--url foo}); + is_deeply($r, $expected, 'options can come from GRAPHQL_CLIENT_OPTIONS') or diag explain $r; + } }; subtest 'expand_vars' => sub {