mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
9cba39a1a1
SOAPBasetype and SOAPCompoundtype. * lib/soap/generator.rb, lib/soap/element.rb, lib/soap/encodingstyle/*: Encoding methods signature change. Pass SOAPGenerator as a parameter. * lib/soap/mapping/*, test/soap/marshal/test_marshal.rb: Refactoring for better marshalling/unmarshalling support. Now I think SOAP marshaller supports all kind of object graph which is supported by Ruby's original marshaller. Of course there could be bugs as always. Find it. :-) * lib/soap/rpc/standaloneServer.rb: Set severity threshould to INFO. DEBUG is too noisy. * lib/xsd/datatypes.rb: DateTime#of is obsoleted. Use DateTime#offset. * test/wsdl/emptycomplextype.wsdl, test/xsd/xmlschema.xml: Avoid useless warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
56 lines
1.4 KiB
Ruby
56 lines
1.4 KiB
Ruby
require 'test/unit'
|
|
require 'tempfile'
|
|
require "#{File.dirname(File.expand_path(__FILE__))}/envutil"
|
|
|
|
class TestBeginEndBlock < Test::Unit::TestCase
|
|
DIR = File.dirname(File.expand_path(__FILE__))
|
|
|
|
def q(content)
|
|
"\"#{content}\""
|
|
end
|
|
|
|
def test_beginendblock
|
|
ruby = EnvUtil.rubybin
|
|
target = File.join(DIR, 'beginmainend.rb')
|
|
io = IO.popen("#{q(ruby)} #{q(target)}")
|
|
assert_equal(%w(b1 b2-1 b2 main b3-1 b3 b4 e1 e4 e3 e2 e4-2 e4-1 e1-1 e4-1-1), io.read.split)
|
|
io.close
|
|
end
|
|
|
|
def test_begininmethod
|
|
assert_raises(SyntaxError) do
|
|
eval("def foo; BEGIN {}; end")
|
|
end
|
|
|
|
assert_raises(SyntaxError) do
|
|
eval('eval("def foo; BEGIN {}; end")')
|
|
end
|
|
end
|
|
|
|
def test_endblockwarn
|
|
ruby = EnvUtil.rubybin
|
|
# Use Tempfile to create temporary file path.
|
|
launcher = Tempfile.new(self.class.name)
|
|
errout = Tempfile.new(self.class.name)
|
|
|
|
launcher << <<EOF
|
|
errout = ARGV.shift
|
|
STDERR.reopen(File.open(errout, "w"))
|
|
STDERR.sync = true
|
|
Dir.chdir(#{q(DIR)})
|
|
cmd = "\\"#{ruby}\\" \\"endblockwarn.rb\\""
|
|
system(cmd)
|
|
EOF
|
|
launcher.close
|
|
launcherpath = launcher.path
|
|
errout.close
|
|
erroutpath = errout.path
|
|
system("#{q(ruby)} #{q(launcherpath)} #{q(erroutpath)}")
|
|
expected = <<EOW
|
|
endblockwarn.rb:2: warning: END in method; use at_exit
|
|
(eval):2: warning: END in method; use at_exit
|
|
EOW
|
|
assert_equal(expected, File.read(erroutpath))
|
|
# expecting Tempfile to unlink launcher and errout file.
|
|
end
|
|
end
|