diff options
author | Eric Wong <e@80x24.org> | 2015-05-17 22:47:05 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-05-17 22:47:05 +0000 |
commit | 3837dda23cf23111a92056ef862017bcf050a865 (patch) | |
tree | f79168e535d730042d3e44ccc6f695d13d292c6c /test/test_env.rb | |
parent | 93ff56a7a27a166ce92307c470d4f54c3c28aa53 (diff) | |
download | dtas-3837dda23cf23111a92056ef862017bcf050a865.tar.gz |
This can make it easier to specify mcompand parameters in socks, as those require separate levels of parameter parsing and require quoting in shell.
Diffstat (limited to 'test/test_env.rb')
-rw-r--r-- | test/test_env.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_env.rb b/test/test_env.rb index bd7961d..6b36f32 100644 --- a/test/test_env.rb +++ b/test/test_env.rb @@ -52,4 +52,20 @@ class TestEnv < Testcase res = env_expand({"PATH"=>"$PATH"}, expand: true) assert_equal ENV["PATH"], res["PATH"] end + + def test_ary + ENV['HELLO'] = 'HIHI' + ENV['PAATH'] = '/usr/local/bin:/usr/bin:/bin' + env = { 'BLAH' => [ '$HELLO/WORLD', '$PAATH', '$(echo hello world)' ] } + res = env_expand(env, expand: true) + exp = [ "HIHI/WORLD", ENV['PAATH'], 'hello world' ] + assert_equal exp, Shellwords.split(res['BLAH']) + env = { + 'BLAH' => [ '$(echo hello world)' ], + 'MOAR' => [ '$BLAH', 'OMG HALP SPACES' ] + } + res = env_expand(env, expand: true) + exp = ["hello\\ world", "OMG HALP SPACES"] + assert_equal exp, Shellwords.split(res['MOAR']) + end end |