From e2f95e02b06704ec9894a1e981263c39354f6559 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sun, 22 Mar 2020 02:53:45 -0600 Subject: [PATCH] test GRAPHQL_CLIENT_OPTIONS --- t/cli.t | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 { -- 2.45.2