diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-13 03:17:28 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-13 03:17:28 +0000 |
commit | bd13788fdbe8617eb3a65e98ddb4acc2b5e4f598 (patch) | |
tree | d85dc3e6fd79d001de5628ba35933c3057985eba /test/test_shellwords.rb | |
parent | 2854a7f121861b7508809815532d6827b8bb9929 (diff) | |
download | ruby-bd13788fdbe8617eb3a65e98ddb4acc2b5e4f598.tar.gz |
lib/shellwords.rb: do not change API with frozen-string-literal
This fixes a bug introduced in r53066 when attempting to
shellescape an empty string.
* lib/shellwords.rb (shellescape): duplicate frozen literal
* test/test_shellwords.rb (test_stringification): new test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_shellwords.rb')
-rw-r--r-- | test/test_shellwords.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/test_shellwords.rb b/test/test_shellwords.rb index 59cdbe96dc..e70e0d72bf 100644 --- a/test/test_shellwords.rb +++ b/test/test_shellwords.rb @@ -48,8 +48,17 @@ class TestShellwords < Test::Unit::TestCase end def test_stringification - assert_equal "3", shellescape(3) - assert_equal "ps -p #{$$}", ['ps', '-p', $$].shelljoin + three = shellescape(3) + assert_equal '3', three + assert_not_predicate three, :frozen? + + empty = shellescape('') + assert_equal "''", empty + assert_not_predicate empty, :frozen? + + joined = ['ps', '-p', $$].shelljoin + assert_equal "ps -p #{$$}", joined + assert_not_predicate joined, :frozen? end def test_multibyte_characters |