mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/envutil.rb: added. split "rubybin" from test_system.rb.
* test/ruby/test_system.rb: use envutil.rb * test/ruby/test_beginendblock.rb: added. * test/ruby/beginmainend.rb: added. used in test_beginendblock.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e85ca8a02
commit
d77b17aa73
5 changed files with 43 additions and 5 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Sun Oct 5 11:54:29 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* test/ruby/envutil.rb: added. split "rubybin" from test_system.rb.
|
||||
|
||||
* test/ruby/test_system.rb: use envutil.rb
|
||||
|
||||
* test/ruby/test_beginendblock.rb: added.
|
||||
|
||||
* test/ruby/beginmainend.rb: added. used in test_beginendblock.rb.
|
||||
|
||||
Sun Oct 5 11:23:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
|
||||
|
||||
* test/testunit/runit/test_testresult.rb: removed some unnecessary
|
||||
|
|
9
test/ruby/beginmainend.rb
Normal file
9
test/ruby/beginmainend.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
BEGIN {
|
||||
puts "begin"
|
||||
}
|
||||
|
||||
puts "main"
|
||||
|
||||
END {
|
||||
puts "end"
|
||||
}
|
10
test/ruby/envutil.rb
Normal file
10
test/ruby/envutil.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
module EnvUtil
|
||||
def rubybin
|
||||
if File.exist? "miniruby" or File.exist? "miniruby.exe"
|
||||
"./miniruby"
|
||||
else
|
||||
"ruby"
|
||||
end
|
||||
end
|
||||
module_function :rubybin
|
||||
end
|
12
test/ruby/test_beginendblock.rb
Normal file
12
test/ruby/test_beginendblock.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
require 'test/unit'
|
||||
require "#{File.dirname(File.expand_path(__FILE__))}/envutil"
|
||||
|
||||
class TestBeginEndBlock < Test::Unit::TestCase
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
def test_beginendblock
|
||||
ruby = EnvUtil.rubybin
|
||||
io = IO.popen("\"#{ruby}\" \"#{DIR}/beginmainend.rb\"")
|
||||
assert_equal("begin\nmain\nend\n", io.read)
|
||||
end
|
||||
end
|
|
@ -1,4 +1,5 @@
|
|||
require 'test/unit'
|
||||
require "#{File.dirname(File.expand_path(__FILE__))}/envutil"
|
||||
|
||||
$KCODE = 'none'
|
||||
|
||||
|
@ -8,11 +9,7 @@ class TestSystem < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_system
|
||||
if File.exist? "miniruby" or File.exist? "miniruby.exe"
|
||||
ruby = "./miniruby"
|
||||
else
|
||||
ruby = "ruby"
|
||||
end
|
||||
ruby = EnvUtil.rubybin
|
||||
assert_equal("foobar\n", `echo foobar`)
|
||||
assert_equal('foobar', `#{ruby} -e 'print "foobar"'`)
|
||||
|
||||
|
|
Loading…
Reference in a new issue