diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-12 18:42:03 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-01-12 18:42:03 +0000 |
commit | 8c72fc9bf09071300b6283411b4481456aac7e34 (patch) | |
tree | 7b107fcfad5476a304edf94b6f9a119cee1d8c7d /test/test_shellwords.rb | |
parent | 44d20d61c7babae9fd2ac3c6578208efa631d5a3 (diff) | |
download | ruby-8c72fc9bf09071300b6283411b4481456aac7e34.tar.gz |
* lib/shellwords.rb (Shellwords#shellsplit): Fix a bug where
consecutive backslashes in double quotes are all removed except
the one at the tail.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_shellwords.rb')
-rw-r--r-- | test/test_shellwords.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_shellwords.rb b/test/test_shellwords.rb index 593f0e0aea..bd44aec1af 100644 --- a/test/test_shellwords.rb +++ b/test/test_shellwords.rb @@ -38,6 +38,15 @@ class TestShellwords < Test::Unit::TestCase end end + def test_backslashes + cmdline, expected = [ + %q{/a//b///c////d/////e/ "/a//b///c////d/////e/ "'/a//b///c////d/////e/ '/a//b///c////d/////e/ }, + %q{a/b/c//d//e a/b/c//d//e /a//b///c////d/////e/ a/b/c//d//e } + ].map { |str| str.tr("/", "\\\\") } + + assert_equal [expected], shellwords(cmdline) + end + def test_multibyte_characters # This is not a spec. It describes the current behavior which may # be changed in future. There would be no multibyte character |