* process.c (rb_spawn_internal): new function to specify
[ruby-svn.git] / test / test_shellwords.rb
blobddb2d870b08c6ee4da794568bb4e81e33aa9e784
1 require 'test/unit'
2 require 'shellwords'
4 class TestShellwords < Test::Unit::TestCase
6   include Shellwords
8   def setup
9     @not_string = Class.new
10     @cmd = "ruby my_prog.rb | less"
11   end
14   def test_string
15     assert_instance_of(Array, shellwords(@cmd))
16     assert_equal(4, shellwords(@cmd).length)
17   end
18   
19   def test_unmatched_double_quote
20     bad_cmd = 'one two "three'
21     assert_raises ArgumentError do
22       shellwords(bad_cmd)
23     end
24   end
25   
26   def test_unmatched_single_quote
27     bad_cmd = "one two 'three"
28     assert_raises ArgumentError do
29       shellwords(bad_cmd)
30     end
31   end
32   
33   def test_unmatched_quotes
34     bad_cmd = "one '"'"''""'""
35     assert_raises ArgumentError do
36       shellwords(bad_cmd)
37     end
38   end
39 end