mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/shellwords.rb (Shellwords#shellsplit): Document that this
method does not treat shell metacharacters as such. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c53479ae8a
commit
273d5004be
3 changed files with 20 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue