зеркало из https://github.com/github/ruby.git
* lib/xmlrpc/parser.rb (FaultException): fix to_s and inspect
* test/xmlrpc/parser.rb: test for the above Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6e7544f132
Коммит
c0f09a8a35
|
@ -54,11 +54,10 @@ module XMLRPC
|
|||
class FaultException < StandardError
|
||||
attr_reader :faultCode, :faultString
|
||||
|
||||
alias message faultString
|
||||
|
||||
def initialize(faultCode, faultString)
|
||||
@faultCode = faultCode
|
||||
@faultString = faultString
|
||||
super(@faultString)
|
||||
end
|
||||
|
||||
# returns a hash
|
||||
|
|
|
@ -65,6 +65,12 @@ module GenericParserTest
|
|||
assert_equal(fault.faultCode, 4)
|
||||
assert_equal(fault.faultString, "an error message")
|
||||
end
|
||||
|
||||
def test_fault_message
|
||||
fault = XMLRPC::FaultException.new(1234, 'an error message')
|
||||
assert_equal('an error message', fault.to_s)
|
||||
assert_equal('#<XMLRPC::FaultException: an error message>', fault.inspect)
|
||||
end
|
||||
end
|
||||
|
||||
# create test class for each installed parser
|
||||
|
|
Загрузка…
Ссылка в новой задаче