summaryrefslogtreecommitdiff
path: root/test/test_shellwords.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_shellwords.rb')
-rw-r--r--test/test_shellwords.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/test/test_shellwords.rb b/test/test_shellwords.rb
index 2916d5dda6..16949c02d3 100644
--- a/test/test_shellwords.rb
+++ b/test/test_shellwords.rb
@@ -40,12 +40,24 @@ class TestShellwords < Test::Unit::TestCase
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)
+ [
+ [
+ %q{/a//b///c////d/////e/ "/a//b///c////d/////e/ "'/a//b///c////d/////e/ '/a//b///c////d/////e/ },
+ 'a/b/c//d//e /a/b//c//d///e/ /a//b///c////d/////e/ a/b/c//d//e '
+ ],
+ [
+ %q{printf %s /"/$/`///"/r/n},
+ 'printf', '%s', '"$`/"rn'
+ ],
+ [
+ %q{printf %s "/"/$/`///"/r/n"},
+ 'printf', '%s', '"$`/"/r/n'
+ ]
+ ].map { |strs|
+ cmdline, *expected = strs.map { |str| str.tr("/", "\\\\") }
+ assert_equal expected, shellwords(cmdline)
+ }
end
def test_stringification