Make tests work on Windows too (with CMD.EXE).

This commit is contained in:
Johan Holmberg 2009-04-03 16:13:01 +00:00 committed by holmberg556
parent 804f7d1932
commit e722de3e84

View File

@ -47,7 +47,7 @@ class CMDTEST_ruby_options < Cmdtest::Testcase
] ]
# with -n # with -n
cmd "#{ruby} -na -e 'p $F' a.txt" do cmd %Q|#{ruby} -na -e "p $F" a.txt| do
stdout_equal [ stdout_equal [
'["a", "1", "x"]', '["a", "1", "x"]',
'["b", "2", "y"]', '["b", "2", "y"]',
@ -56,12 +56,8 @@ class CMDTEST_ruby_options < Cmdtest::Testcase
end end
# with -p # with -p
cmd "#{ruby} -pa -e '$_ = $F.inspect + %Q/\\n/' a.txt" do cmd %Q|#{ruby} -pa -e "$_ = $F.inspect" a.txt| do
stdout_equal [ stdout_equal '["a", "1", "x"]["b", "2", "y"]["c", "3"]'
'["a", "1", "x"]',
'["b", "2", "y"]',
'["c", "3"]',
]
end end
end end
@ -117,7 +113,7 @@ class CMDTEST_ruby_options < Cmdtest::Testcase
end end
# several -e options # several -e options
cmd "#{ruby} -e 'puts :hello' -e 'puts :world' -e 'puts 123'" do cmd %Q|#{ruby} -e "puts :hello" -e "puts :world" -e "puts 123"| do
stdout_equal [ stdout_equal [
"hello", "hello",
"world", "world",
@ -126,14 +122,14 @@ class CMDTEST_ruby_options < Cmdtest::Testcase
end end
# ARGV as usual # ARGV as usual
cmd "#{ruby} -e 'p ARGV' 11 22 33" do cmd %Q|#{ruby} -e "p ARGV" 11 22 33| do
stdout_equal [ stdout_equal [
'["11", "22", "33"]', '["11", "22", "33"]',
] ]
end end
# side effects seen in later -e # side effects seen in later -e
cmd "#{ruby} -e 'a = []' -e 'a << 11' -e 'a << 22' -e 'p a'" do cmd %Q|#{ruby} -e "a = []" -e "a << 11" -e "a << 22" -e "p a"| do
stdout_equal [ stdout_equal [
'[11, 22]', '[11, 22]',
] ]
@ -191,7 +187,7 @@ class CMDTEST_ruby_options < Cmdtest::Testcase
] ]
# one-line script # one-line script
cmd "#{ruby} -p -e 'puts $_ if /[13]/' a.txt" do cmd %Q|#{ruby} -p -e "puts $_ if /[13]/" a.txt| do
stdout_equal [ stdout_equal [
'line 1', 'line 1',
'line 1', 'line 1',
@ -216,7 +212,7 @@ class CMDTEST_ruby_options < Cmdtest::Testcase
end end
# modifying $_ before automatic print # modifying $_ before automatic print
cmd "#{ruby} -p -e '$_ = %Q/.../ + $_' a.txt" do cmd %Q|#{ruby} -p -e "$_ = '...' + $_" a.txt| do
stdout_equal [ stdout_equal [
'...line 1', '...line 1',
'...line 2', '...line 2',