From: Charles McGarvey Date: Sun, 22 Mar 2020 08:53:45 +0000 (-0600) Subject: test GRAPHQL_CLIENT_OPTIONS X-Git-Tag: v0.604~2 X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=e2f95e02b06704ec9894a1e981263c39354f6559;p=chaz%2Fgraphql-client test GRAPHQL_CLIENT_OPTIONS --- 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 {