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.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/test_shellwords.rb b/test/test_shellwords.rb
index e70e0d72bf2..3ead5f7c491 100644
--- a/test/test_shellwords.rb
+++ b/test/test_shellwords.rb
@@ -6,15 +6,15 @@ class TestShellwords < Test::Unit::TestCase
include Shellwords
- def setup
- @not_string = Class.new
- @cmd = "ruby my_prog.rb | less"
- end
-
+ def test_shellwords
+ cmd1 = "ruby -i'.bak' -pe \"sub /foo/, '\\\\&bar'\" foobar\\ me.txt\n"
+ assert_equal(['ruby', '-i.bak', '-pe', "sub /foo/, '\\&bar'", "foobar me.txt"],
+ shellwords(cmd1))
- def test_string
- assert_instance_of(Array, shellwords(@cmd))
- assert_equal(4, shellwords(@cmd).length)
+ # shellwords does not interpret meta-characters
+ cmd2 = "ruby my_prog.rb | less"
+ assert_equal(['ruby', 'my_prog.rb', '|', 'less'],
+ shellwords(cmd2))
end
def test_unmatched_double_quote