You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/02/14 16:51:20 UTC
[2/4] qpid-proton git commit: PROTON-1738: [ruby] Make tests
compatible with ruby 2.0.0
PROTON-1738: [ruby] Make tests compatible with ruby 2.0.0
Rewrite tests in older style for minitest/spec and minitest/unit
Add missing require 'rbconfig' for older versions.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/71e8c7b2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/71e8c7b2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/71e8c7b2
Branch: refs/heads/master
Commit: 71e8c7b2ede3a8510a8a3152c861d6a197d163ce
Parents: 83205db
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Feb 13 19:16:32 2018 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Feb 14 11:34:02 2018 -0500
----------------------------------------------------------------------
examples/ruby/example_test.rb | 7 +
proton-c/bindings/ruby/spec/array_spec.rb | 26 +--
proton-c/bindings/ruby/spec/data_spec.rb | 150 ++++++-------
.../ruby/spec/exception_handling_spec.rb | 16 +-
proton-c/bindings/ruby/spec/hash_spec.rb | 6 +-
proton-c/bindings/ruby/spec/message_spec.rb | 220 +++++++++----------
.../ruby/tests/old_examples/old_example_test.rb | 7 +
.../ruby/tests/test_connection_driver.rb | 3 +-
proton-c/bindings/ruby/tests/test_container.rb | 4 +-
proton-c/bindings/ruby/tests/test_data.rb | 4 +-
proton-c/bindings/ruby/tests/test_delivery.rb | 2 +-
proton-c/bindings/ruby/tests/test_interop.rb | 3 +-
.../ruby/tests/test_messaging_adapter.rb | 2 +-
.../bindings/ruby/tests/test_old_adapter.rb | 4 +-
proton-c/bindings/ruby/tests/test_tools.rb | 7 +-
proton-c/bindings/ruby/tests/test_uri.rb | 4 +-
16 files changed, 239 insertions(+), 226 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/examples/ruby/example_test.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/example_test.rb b/examples/ruby/example_test.rb
index e19855d..80a20db 100755
--- a/examples/ruby/example_test.rb
+++ b/examples/ruby/example_test.rb
@@ -21,6 +21,13 @@
require 'minitest/autorun'
require 'qpid_proton'
require 'socket'
+require 'rbconfig'
+
+begin
+ MiniTest::Test
+rescue NameError # For older versions of MiniTest
+ MiniTest::Test = MiniTest::Unit::TestCase
+end
# URL with an unused port
def test_url()
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/spec/array_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/array_spec.rb b/proton-c/bindings/ruby/spec/array_spec.rb
index ce73760..dda783e 100644
--- a/proton-c/bindings/ruby/spec/array_spec.rb
+++ b/proton-c/bindings/ruby/spec/array_spec.rb
@@ -32,47 +32,41 @@ describe "The extended array type" do
it "can be created like a normal array" do
value = []
- expect(value).respond_to?(:proton_put)
- expect(value).respond_to?(:proton_array_header)
- expect(value.class).respond_to?(:proton_get)
- expect(value).respond_to? :proton_described?
+ value.must_respond_to(:proton_put)
+ value.must_respond_to(:proton_array_header)
+ value.class.must_respond_to(:proton_get)
end
it "raises an error when the current object is not a list" do
@data.string = random_string(128)
@data.rewind
-
- expect {
- @data.list
- }.must_raise(TypeError)
+ proc { @data.list }.must_raise(TypeError)
end
it "can be put into a Data object as a list" do
@data.list= @list
result = @data.list
- expect(result).must_equal(@list)
+ result.must_equal(@list)
end
it "raises an error when the elements of an Array are dissimilar and is put into a Data object" do
value = Qpid::Proton::Types::UniformArray.new(Qpid::Proton::Codec::INT)
value << random_string(16)
- expect {
- @data << value
- }.must_raise(TypeError)
+ proc { @data << value }.must_raise(TypeError)
end
it "can be put into a Data object as an undescribed array" do
@data << @undescribed
result = @data.array
- expect(result).is_a? Qpid::Proton::Types::UniformArray
- expect(@undescribed).must_equal(result)
+ result.must_be_kind_of Qpid::Proton::Types::UniformArray
+ @undescribed.must_equal(result)
end
it "can be put into a Data object as a described array" do
@data << @described
result = @data.array
- expect(@described).must_equal(result)
- expect(result).is_a? Qpid::Proton::Types::UniformArray
+ @described.must_equal(result)
+ result.must_be_kind_of Qpid::Proton::Types::UniformArray
end
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/spec/data_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/data_spec.rb b/proton-c/bindings/ruby/spec/data_spec.rb
index d5c92fb..041cf01 100644
--- a/proton-c/bindings/ruby/spec/data_spec.rb
+++ b/proton-c/bindings/ruby/spec/data_spec.rb
@@ -30,32 +30,32 @@ module Qpid
end
it "can be initialized" do
- expect(@data).wont_be_nil
+ @data.wont_be_nil
end
it "can hold a null" do
@data.null = nil
- expect(@data.null?).must_equal(true)
+ @data.null?.must_equal(true)
end
it "can hold a true boolean" do
@data.bool = true
- expect(@data.bool).must_equal(true)
+ @data.bool.must_equal(true)
end
it "can hold a false boolean" do
@data.bool = false
- expect(@data.bool).must_equal(false)
+ @data.bool.must_equal(false)
end
it "raises an error on a negative ubyte" do
- expect {
+ proc {
@data.ubyte = (0 - (rand(127) + 1))
}.must_raise(RangeError)
end
it "raises an error on a null ubyte" do
- expect {
+ proc {
@data.ubyte = nil
}.must_raise(TypeError)
end
@@ -63,46 +63,46 @@ module Qpid
it "can hold an unsigned byte" do
value = rand(255)
@data.ubyte = value
- expect(@data.ubyte).must_equal(value)
+ @data.ubyte.must_equal(value)
end
it "can hold a byte" do
value = rand(128)
@data.byte = value
- expect(@data.byte).must_equal(value)
+ @data.byte.must_equal(value)
end
it "can hold a negative byte" do
value = 0 - (rand(126) + 1)
@data.byte = value
- expect(@data.byte).must_equal(value)
+ @data.byte.must_equal(value)
end
it "raises an error on a negative ushort" do
- expect {
+ proc {
@data.ushort = (0 - (rand(65535) + 1))
}.must_raise(RangeError)
end
it "raises an error on a nil ushort" do
- expect {
+ proc {
@data.ushort = nil
}.must_raise(TypeError)
end
it "can hold a zero unsigned short" do
@data.ushort = 0
- expect(@data.ushort).must_equal(0)
+ @data.ushort.must_equal(0)
end
it "can hold an unsigned short" do
value = rand(2**15) + 1
@data.ushort = value
- expect(@data.ushort).must_equal(value)
+ @data.ushort.must_equal(value)
end
it "raises an error on a nil short" do
- expect {
+ proc {
@data.short = nil
}.must_raise(TypeError)
end
@@ -110,28 +110,28 @@ module Qpid
it "can hold a short" do
value = rand(2**15) + 1
@data.short = value
- expect(@data.short).must_equal(value)
+ @data.short.must_equal(value)
end
it "can hold a zero short" do
@data.short = 0
- expect(@data.short).must_equal(0)
+ @data.short.must_equal(0)
end
it "can hold a negative short" do
value = (0 - (rand(2**15) + 1))
@data.short = value
- expect(@data.short).must_equal(value)
+ @data.short.must_equal(value)
end
it "raises an error on a nil uint" do
- expect {
+ proc {
@data.uint = nil
}.must_raise(TypeError)
end
it "raises an error on a negative uint" do
- expect {
+ proc {
@data.uint = (0 - (rand(2**32) + 1))
}.must_raise(RangeError)
end
@@ -139,16 +139,16 @@ module Qpid
it "can hold an unsigned integer" do
value = rand(2**32) + 1
@data.uint = value
- expect(@data.uint).must_equal(value)
+ @data.uint.must_equal(value)
end
it "can hold a zero unsigned integer" do
@data.uint = 0
- expect(@data.uint).must_equal(0)
+ @data.uint.must_equal(0)
end
it "raise an error on a null integer" do
- expect {
+ proc {
@data.int = nil
}.must_raise(TypeError)
end
@@ -156,16 +156,16 @@ module Qpid
it "can hold an integer" do
value = rand(2**31) + 1
@data.int = value
- expect(@data.int).must_equal(value)
+ @data.int.must_equal(value)
end
it "can hold zero as an integer" do
@data.int = 0
- expect(@data.int).must_equal(0)
+ @data.int.must_equal(0)
end
it "raises an error on a null character" do
- expect {
+ proc {
@data.char = nil
}.must_raise(TypeError)
end
@@ -175,51 +175,51 @@ module Qpid
index = rand(source.length)
value = source[index,1].bytes.to_a[0]
@data.char = value
- expect(@data.char).must_equal(value)
+ @data.char.must_equal(value)
end
it "raises an error on a null ulong" do
- expect {
+ proc {
@data.ulong = nil
}.must_raise(TypeError)
end
it "raises an error on a negative ulong" do
- expect {
+ proc {
@data.ulong = (0 - (rand(2**63) + 1))
}.must_raise(RangeError)
end
it "can have a zero unsigned long" do
@data.ulong = 0
- expect(@data.ulong).must_equal(0)
+ @data.ulong.must_equal(0)
end
it "can hold an unsigned long" do
value = rand(2**63) + 1
@data.ulong = value
- expect(@data.ulong).must_equal(value)
+ @data.ulong.must_equal(value)
end
it "raises an error on a null long" do
- expect {
+ proc {
@data.long = nil
}.must_raise(TypeError)
end
it "can have a zero long" do
@data.long = 0
- expect(@data.long).must_equal(0)
+ @data.long.must_equal(0)
end
it "can hold a long" do
value = rand(2**63) + 1
@data.long = value
- expect(@data.long).must_equal(value)
+ @data.long.must_equal(value)
end
it "raise an error on a null timestamp" do
- expect {
+ proc {
@data.timestamp = nil
}.must_raise(TypeError)
end
@@ -227,22 +227,22 @@ module Qpid
it "can handle a negative timestamp" do
last_year = Time.now - (60*60*24*365)
@data.timestamp = last_year
- expect(@data.timestamp).must_equal(last_year.to_i)
+ @data.timestamp.must_equal(last_year.to_i)
end
it "can handle a zero timestamp" do
@data.timestamp = 0
- expect(@data.timestamp).must_equal(0)
+ @data.timestamp.must_equal(0)
end
it "can hold a timestamp" do
next_year = Time.now + (60*60*24*365)
@data.timestamp = next_year
- expect(@data.timestamp).must_equal(next_year.to_i)
+ @data.timestamp.must_equal(next_year.to_i)
end
it "raises an error on a null float" do
- expect {
+ proc {
@data.float = nil
}.must_raise(TypeError)
end
@@ -250,22 +250,22 @@ module Qpid
it "can hold a negative float" do
value = 0.0 - (1.0 + rand(2.0**15)).to_f
@data.float = value
- expect(@data.float).must_equal(value)
+ @data.float.must_equal(value)
end
it "can hold a zero float" do
@data.float = 0.0
- expect(@data.float).must_equal(0.0)
+ @data.float.must_equal(0.0)
end
it "can hold a float" do
value = (1.0 + rand(2.0**15)).to_f
@data.float = value
- expect(@data.float).must_equal(value)
+ @data.float.must_equal(value)
end
it "raise an error on a null double" do
- expect {
+ proc {
@data.double = nil
}.must_raise(TypeError)
end
@@ -273,125 +273,125 @@ module Qpid
it "can hold a negative double" do
value = 0.0 - (1.0 + rand(2.0**31)).to_f
@data.double = value
- expect(@data.double).must_equal(value)
+ @data.double.must_equal(value)
end
it "can hold a zero double" do
@data.double = 0.0
- expect(@data.double).must_equal(0.0)
+ @data.double.must_equal(0.0)
end
it "can hold a double" do
value = (1.0 + rand(2.0**31)).to_f
@data.double = value
- expect(@data.double).must_equal(value)
+ @data.double.must_equal(value)
end
it "raises an error on a null decimal32" do
- expect {
+ proc {
@data.decimal32 = nil
}.must_raise(TypeError)
end
it "can hold a zero decimal32" do
@data.decimal32 = 0
- expect(@data.decimal32).must_equal(0)
+ @data.decimal32.must_equal(0)
end
it "can hold a decimal32" do
value = 1 + rand(2**31)
@data.decimal32 = value
- expect(@data.decimal32).must_equal(value)
+ @data.decimal32.must_equal(value)
end
it "raises an error on a null decimal64" do
- expect {
+ proc {
@data.decimal64 = nil
}.must_raise(TypeError)
end
it "can hold a zero decimal64" do
@data.decimal64 = 0
- expect(@data.decimal64).must_equal(0)
+ @data.decimal64.must_equal(0)
end
it "can hold a decimal64" do
value = 1 + rand(2**63)
@data.decimal64 = value
- expect(@data.decimal64).must_equal(value)
+ @data.decimal64.must_equal(value)
end
it "raises an error on a null decimal128" do
- expect {
+ proc {
@data.decimal128 = nil
}.must_raise(TypeError)
end
it "can hold a zero decimal128" do
@data.decimal128 = 0
- expect(@data.decimal128).must_equal(0)
+ @data.decimal128.must_equal(0)
end
it "can hold a decimal128" do
value = rand(2**127)
@data.decimal128 = value
- expect(@data.decimal128).must_equal(value)
+ @data.decimal128.must_equal(value)
end
it "raises an error on a null UUID" do
- expect {
+ proc {
@data.uuid = nil
}.must_raise(::ArgumentError)
end
it "raises an error on a malformed UUID" do
- expect {
+ proc {
@data.uuid = random_string(36)
}.must_raise(::ArgumentError)
end
it "can set a UUID from an integer value" do
@data.uuid = 336307859334295828133695192821923655679
- expect(@data.uuid).must_equal("fd0289a5-8eec-4a08-9283-81d02c9d2fff")
+ @data.uuid.must_equal("fd0289a5-8eec-4a08-9283-81d02c9d2fff")
end
it "can hold a UUID" do
value = "fd0289a5-8eec-4a08-9283-81d02c9d2fff"
@data.uuid = value
- expect(@data.uuid).must_equal(value)
+ @data.uuid.must_equal(value)
end
it "can hold a null binary" do
@data.binary = nil
- expect(@data.binary).must_equal("")
+ @data.binary.must_equal("")
end
it "can hold a binary" do
value = random_string(128)
@data.binary = value
- expect(@data.binary).must_equal(value)
+ @data.binary.must_equal(value)
end
it "can hold a null string" do
@data.string = nil
- expect(@data.string).must_equal("")
+ @data.string.must_equal("")
end
it "can hold a string" do
value = random_string(128)
@data.string = value
- expect(@data.string).must_equal(value)
+ @data.string.must_equal(value)
end
it "can hold a null symbol" do
@data.symbol = nil
- expect(@data.symbol).must_equal(:"")
+ @data.symbol.must_equal(:"")
end
it "can hold a symbol" do
value = random_string(128).to_sym
@data.symbol = value
- expect(@data.symbol).must_equal(value)
+ @data.symbol.must_equal(value)
end
it "can hold a described value" do
@@ -403,16 +403,16 @@ module Qpid
@data.string = value
@data.exit
- expect(@data.described?).must_equal(true)
+ @data.described?.must_equal(true)
@data.enter
@data.next
- expect(@data.symbol).must_equal(name)
+ @data.symbol.must_equal(name)
@data.next
- expect(@data.string).must_equal(value)
+ @data.string.must_equal(value)
end
it "raises an error when setting the wrong type in an array" do
- expect {
+ proc {
@data << Qpid::Proton::Types::UniformArray.new(Qpid::Proton::Types::INT, [1, 2.0, :a, "b"])
}.must_raise(TypeError)
end
@@ -428,7 +428,7 @@ module Qpid
@data.enter
values.each do |value|
@data.next
- expect(@data.int).must_equal(value)
+ @data.int.must_equal(value)
end
end
@@ -442,13 +442,13 @@ module Qpid
values.each { |value| @data.string = value }
@data.exit
- expect(@data.get_array).must_equal([values.size, true, Qpid::Proton::Codec::STRING.code])
+ @data.get_array.must_equal([values.size, true, Qpid::Proton::Codec::STRING.code])
@data.enter
@data.next
- expect(@data.symbol).must_equal(descriptor)
+ @data.symbol.must_equal(descriptor)
values.each do |value|
@data.next
- expect(@data.string).must_equal(value)
+ @data.string.must_equal(value)
end
end
@@ -463,7 +463,7 @@ module Qpid
@data.enter
values.each do |value|
@data.next
- expect(@data.string).must_equal(value)
+ @data.string.must_equal(value)
end
end
@@ -484,9 +484,9 @@ module Qpid
@data.enter
keys.each do |key|
@data.next
- expect(@data.string).must_equal(key)
+ @data.string.must_equal(key)
@data.next
- expect(@data.string).must_equal(values[key])
+ @data.string.must_equal(values[key])
end
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/spec/exception_handling_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/exception_handling_spec.rb b/proton-c/bindings/ruby/spec/exception_handling_spec.rb
index 7470e37..acfb55e 100644
--- a/proton-c/bindings/ruby/spec/exception_handling_spec.rb
+++ b/proton-c/bindings/ruby/spec/exception_handling_spec.rb
@@ -41,49 +41,49 @@ module Qpid
end
it "raises EOS on PN_EOS" do
- expect {
+ proc {
@handler.check_for_error(Qpid::Proton::Error::EOS)
}.must_raise(Qpid::Proton::EOSError)
end
it "raises Error on PN_ERR" do
- expect {
+ proc {
@handler.check_for_error(Qpid::Proton::Error::ERROR)
}.must_raise(Qpid::Proton::ProtonError)
end
it "raises Overflow on PN_OVERFLOW" do
- expect {
+ proc {
@handler.check_for_error(Qpid::Proton::Error::OVERFLOW)
}.must_raise(Qpid::Proton::OverflowError)
end
it "raises Underflow on PN_UNDERFLOW" do
- expect {
+ proc {
@handler.check_for_error(Qpid::Proton::Error::UNDERFLOW)
}.must_raise(Qpid::Proton::UnderflowError)
end
it "raises Argument on PN_ARG_ERR" do
- expect {
+ proc {
@handler.check_for_error(Qpid::Proton::Error::ARGUMENT)
}.must_raise(Qpid::Proton::ArgumentError)
end
it "raises Timeout on PN_TIMEOUT" do
- expect {
+ proc {
@handler.check_for_error(Qpid::Proton::Error::TIMEOUT)
}.must_raise(Qpid::Proton::TimeoutError)
end
it "raises an Ruby ArgumentError on a nil code" do
- expect {
+ proc {
@handler.check_for_error(nil)
}.must_raise(::ArgumentError)
end
it "raises a Ruby ArgumentError on an unknown value" do
- expect {
+ proc {
@handler.check_for_error("farkle")
}.must_raise(::ArgumentError)
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/spec/hash_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/hash_spec.rb b/proton-c/bindings/ruby/spec/hash_spec.rb
index 92acd0a..8ef4177 100644
--- a/proton-c/bindings/ruby/spec/hash_spec.rb
+++ b/proton-c/bindings/ruby/spec/hash_spec.rb
@@ -29,15 +29,15 @@ describe "The extended hash type" do
it "can be put into an instance of Data" do
@hash.proton_data_put(@data)
result = Hash.proton_data_get(@data)
- expect(result.keys).must_equal(@hash.keys)
- expect(result.values).must_equal(@hash.values)
+ result.keys.must_equal(@hash.keys)
+ result.values.must_equal(@hash.values)
end
it "raises an error when trying to get what is not a Hash" do
@data.string = random_string(128)
@data.rewind
- expect {
+ proc {
Hash.proton_data_get(@data)
}.must_raise(TypeError)
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/spec/message_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/message_spec.rb b/proton-c/bindings/ruby/spec/message_spec.rb
index 2951f9c..eacabcc 100644
--- a/proton-c/bindings/ruby/spec/message_spec.rb
+++ b/proton-c/bindings/ruby/spec/message_spec.rb
@@ -29,38 +29,38 @@ module Qpid
end
it "can be created" do
- expect(@message).wont_be_nil
+ @message.wont_be_nil
end
it "can be cleared" do
subject = random_string(16)
@message.subject = subject
- expect(@message.subject).must_equal(subject)
+ @message.subject.must_equal(subject)
@message.clear
- expect(@message.subject).wont_equal(subject)
+ @message.subject.wont_equal(subject)
end
it "can be durable" do
@message.durable = true
- expect(@message.durable).must_equal(true)
+ @message.durable.must_equal(true)
@message.durable = false
- expect(@message.durable).must_equal(false)
+ @message.durable.must_equal(false)
end
it "raises an error when setting durable to nil" do
- expect {
+ proc {
@message.durable = nil
}.must_raise(TypeError)
end
it "raises an error when setting the priority to nil" do
- expect {
+ proc {
@message.priority = nil
}.must_raise(TypeError)
end
it "raises an error when setting the priority to a non-number" do
- expect {
+ proc {
@message.priority = "abck"
}.must_raise(TypeError)
end
@@ -68,17 +68,17 @@ module Qpid
it "sets the priority to the integer portion when a float" do
priority = rand(100) / 10
@message.priority = priority
- expect(@message.priority).must_equal(priority.floor)
+ @message.priority.must_equal(priority.floor)
end
it "rejects a priority with too large of a value" do
- expect {
+ proc {
@message.priority = (rand(100) + 256)
}.must_raise(RangeError)
end
it "rejects a negative priority" do
- expect {
+ proc {
@message.priority = (0 - (rand(255) + 1))
}.must_raise(RangeError)
end
@@ -86,17 +86,17 @@ module Qpid
it "has a priority" do
priority = rand(256)
@message.priority = priority
- expect(@message.priority).must_equal(priority)
+ @message.priority.must_equal(priority)
end
it "raises an error when setting the time-to-live to nil" do
- expect {
+ proc {
@message.ttl = nil
}.must_raise(TypeError)
end
it "raises an error when setting the time-to-live to a non-number" do
- expect {
+ proc {
@message.ttl = random_string(5)
}.must_raise(TypeError)
end
@@ -104,11 +104,11 @@ module Qpid
it "sets the time-to-live to the integer portion when a float" do
ttl = (rand(32767) / 10)
@message.ttl = ttl
- expect(@message.ttl).must_equal(ttl.floor)
+ @message.ttl.must_equal(ttl.floor)
end
it "raises an error when the time-to-live is negative" do
- expect {
+ proc {
@message.ttl = (0 - rand(1000))
}.must_raise(RangeError)
end
@@ -116,43 +116,43 @@ module Qpid
it "has a time-to-live" do
ttl = rand(32767)
@message.ttl = ttl
- expect(@message.ttl).must_equal(ttl)
+ @message.ttl.must_equal(ttl)
end
it "raises an error when setting first acquirer to nil" do
- expect {
+ proc {
@message.first_acquirer = nil
}.must_raise(TypeError)
end
it "raises and error when setting first acquirer to a non-boolean" do
- expect {
+ proc {
@message.first_acquirer = random_string(16)
}.must_raise(TypeError)
end
it "has a first acquirer" do
@message.first_acquirer = true
- expect(@message.first_acquirer?).must_equal(true)
+ @message.first_acquirer?.must_equal(true)
@message.first_acquirer = false
- expect(@message.first_acquirer?).must_equal(false)
+ @message.first_acquirer?.must_equal(false)
end
it "raises an error on a nil delivery count" do
- expect {
+ proc {
@message.delivery_count = nil
}.must_raise(::ArgumentError)
end
it "raises an error on a negative delivery count" do
- expect {
+ proc {
@message.delivery_count = -1
}.must_raise(RangeError)
end
it "raises an error on a non-numeric delivery count" do
- expect {
+ proc {
@message.delivery_count = "farkle"
}.must_raise(::ArgumentError)
end
@@ -160,173 +160,173 @@ module Qpid
it "converts a floating point delivery count to its integer portion" do
count = rand(255) / 10.0
@message.delivery_count = count
- expect(@message.delivery_count).must_equal(count.floor)
+ @message.delivery_count.must_equal(count.floor)
end
it "has a delivery count" do
count = rand(255)
@message.delivery_count = count
- expect(@message.delivery_count).must_equal(count)
+ @message.delivery_count.must_equal(count)
end
it "allows setting a nil id" do
@message.id = nil
- expect(@message.id).must_be_nil
+ @message.id.must_be_nil
end
it "has an id" do
id = random_string(16)
@message.id = id
- expect(@message.id).must_equal(id)
+ @message.id.must_equal(id)
end
it "allows setting a nil user id" do
@message.user_id = nil
- expect(@message.user_id).must_equal("")
+ @message.user_id.must_equal("")
end
it "has a user id" do
id = random_string(16)
@message.user_id = id
- expect(@message.user_id).must_equal(id)
+ @message.user_id.must_equal(id)
end
it "allows setting a nil address" do
@message.address = nil
- expect(@message.address).must_be_nil
+ @message.address.must_be_nil
end
it "has an address" do
address = "//0.0.0.0/#{random_string(16)}"
@message.address = address
- expect(@message.address).must_equal(address)
+ @message.address.must_equal(address)
end
it "allows setting a nil subject" do
@message.subject = nil
- expect(@message.subject).must_be_nil
+ @message.subject.must_be_nil
end
it "has a subject" do
subject = random_string(50)
@message.subject = subject
- expect(@message.subject).must_equal(subject)
+ @message.subject.must_equal(subject)
end
it "will allow a nil reply-to address" do
@message.reply_to = nil
- expect(@message.reply_to).must_be_nil
+ @message.reply_to.must_be_nil
end
it "has a reply-to address" do
address = "//0.0.0.0/#{random_string(16)}"
@message.reply_to = address
- expect(@message.reply_to).must_equal(address)
+ @message.reply_to.must_equal(address)
end
it "will allow a nil correlation id" do
@message.correlation_id = nil
- expect(@message.correlation_id).must_be_nil
+ @message.correlation_id.must_be_nil
end
it "has a correlation id" do
id = random_string(25)
@message.correlation_id = id
- expect(@message.correlation_id).must_equal(id)
+ @message.correlation_id.must_equal(id)
end
it "will allow a nil content type" do
@message.content_type = nil
- expect(@message.content_type).must_be_nil
+ @message.content_type.must_be_nil
end
it "will allow an empty content type" do
@message.content_type = ""
- expect(@message.content_type).must_equal("")
+ @message.content_type.must_equal("")
end
it "has a content type" do
content_type = random_string(32)
@message.content_type = content_type
- expect(@message.content_type).must_equal(content_type)
+ @message.content_type.must_equal(content_type)
end
it "can have nil content encoding" do
@message.content_encoding = nil
- expect(@message.content_encoding).must_be_nil
+ @message.content_encoding.must_be_nil
end
it "has a content encoding" do
encoding = "#{random_string(8)}/#{random_string(8)}"
@message.content_encoding = encoding
- expect(@message.content_encoding).must_equal(encoding)
+ @message.content_encoding.must_equal(encoding)
end
it "raises an error on a nil expiry time" do
- expect {
+ proc {
@message.expires = nil
}.must_raise(TypeError)
end
it "raises an error on a negative expiry time" do
- expect {
+ proc {
@message.expires = (0-(rand(65535)))
}.must_raise(::ArgumentError)
end
it "can have a zero expiry time" do
@message.expires = 0
- expect(@message.expires).must_equal(0)
+ @message.expires.must_equal(0)
end
it "has an expiry time" do
time = rand(65535)
@message.expires = time
- expect(@message.expires).must_equal(time)
+ @message.expires.must_equal(time)
end
it "raises an error on a nil creation time" do
- expect {
+ proc {
@message.creation_time = nil
}.must_raise(TypeError)
end
it "raises an error on a negative creation time" do
- expect {
+ proc {
@message.creation_time = (0 - rand(65535))
}.must_raise(::ArgumentError)
end
it "can have a zero creation time" do
@message.creation_time = 0
- expect(@message.creation_time).must_equal(0)
+ @message.creation_time.must_equal(0)
end
it "has a creation time" do
time = rand(65535)
@message.creation_time = time
- expect(@message.creation_time).must_equal(time)
+ @message.creation_time.must_equal(time)
end
it "can have a nil group id" do
@message.group_id = nil
- expect(@message.group_id).must_be_nil
+ @message.group_id.must_be_nil
end
it "can have an empty group id" do
@message.group_id = ""
- expect(@message.group_id).must_equal("")
+ @message.group_id.must_equal("")
end
it "has a group id" do
id = random_string(16)
@message.group_id = id
- expect(@message.group_id).must_equal(id)
+ @message.group_id.must_equal(id)
end
it "raises an error on a nil group sequence" do
- expect {
+ proc {
@message.group_sequence = nil
}.must_raise(TypeError)
end
@@ -334,50 +334,50 @@ module Qpid
it "can have a negative group sequence" do
seq = (0 - rand(32767))
@message.group_sequence = seq
- expect(@message.group_sequence).must_equal(seq)
+ @message.group_sequence.must_equal(seq)
end
it "can have a zero group sequence" do
@message.group_sequence = 0
- expect(@message.group_sequence).must_equal(0)
+ @message.group_sequence.must_equal(0)
end
it "has a group sequence" do
id = rand(32767)
@message.group_sequence = id
- expect(@message.group_sequence).must_equal(id)
+ @message.group_sequence.must_equal(id)
end
it "can have a nil reply-to group id" do
@message.reply_to_group_id = nil
- expect(@message.reply_to_group_id).must_be_nil
+ @message.reply_to_group_id.must_be_nil
end
it "can have an empty reply-to group id" do
@message.reply_to_group_id = ""
- expect(@message.reply_to_group_id).must_equal("")
+ @message.reply_to_group_id.must_equal("")
end
it "has a reply-to group id" do
id = random_string(16)
@message.reply_to_group_id = id
- expect(@message.reply_to_group_id).must_equal(id)
+ @message.reply_to_group_id.must_equal(id)
end
it "has properties" do
- expect(@message).must_respond_to(:properties)
- expect(@message).must_respond_to(:properties=)
- expect(@message).must_respond_to(:[])
- expect(@message).must_respond_to(:[]=)
+ @message.must_respond_to(:properties)
+ @message.must_respond_to(:properties=)
+ @message.must_respond_to(:[])
+ @message.must_respond_to(:[]=)
- expect(@message.properties).must_be_kind_of({}.class)
+ @message.properties.must_be_kind_of({}.class)
end
it "can replace the set of properties" do
values = random_hash(128)
@message.properties = values.clone
- expect(@message.properties).must_equal(values)
+ @message.properties.must_equal(values)
end
it "can set properties" do
@@ -385,7 +385,7 @@ module Qpid
value = random_string(128)
@message[name] = value
- expect(@message[name]).must_equal(value)
+ @message[name].must_equal(value)
end
it "can update properties" do
@@ -393,11 +393,11 @@ module Qpid
value = random_string(128)
@message[name] = value
- expect(@message[name]).must_equal(value)
+ @message[name].must_equal(value)
value = random_string(128)
@message[name] = value
- expect(@message[name]).must_equal(value)
+ @message[name].must_equal(value)
end
it "can hold a null property" do
@@ -405,10 +405,10 @@ module Qpid
value = random_string(128)
@message[name] = value
- expect(@message[name]).must_equal(value)
+ @message[name].must_equal(value)
@message[name] = nil
- expect(@message[name]).must_be_nil
+ @message[name].must_be_nil
end
it "can delete a property" do
@@ -416,10 +416,10 @@ module Qpid
value = random_string(128)
@message[name] = value
- expect(@message[name]).must_equal(value)
+ @message[name].must_equal(value)
@message.delete_property(name)
- expect(@message.properties.keys).wont_include(name)
+ @message.properties.keys.wont_include(name)
end
it "has no properties after being cleared" do
@@ -427,15 +427,15 @@ module Qpid
value = random_string(128)
@message[name] = value
- expect(@message[name]).must_equal(value)
+ @message[name].must_equal(value)
@message.clear
- expect(@message.properties).must_be_empty
+ @message.properties.must_be_empty
end
it "has instructions" do
- expect(@message).must_respond_to(:instructions)
- expect(@message).must_respond_to("instructions=".to_sym)
+ @message.must_respond_to(:instructions)
+ @message.must_respond_to("instructions=".to_sym)
end
it "can set an instruction" do
@@ -443,7 +443,7 @@ module Qpid
value = random_string(128)
@message.instructions[name] = value
- expect(@message.instructions[name]).must_equal(value)
+ @message.instructions[name].must_equal(value)
end
it "can update an instruction" do
@@ -451,11 +451,11 @@ module Qpid
value = random_string(128)
@message.instructions[name] = value
- expect(@message.instructions[name]).must_equal(value)
+ @message.instructions[name].must_equal(value)
value = random_string(128)
@message.instructions[name] = value
- expect(@message.instructions[name]).must_equal(value)
+ @message.instructions[name].must_equal(value)
end
it "can delete the instructions" do
@@ -463,47 +463,47 @@ module Qpid
value = random_string(128)
@message.instructions[name] = value
- expect(@message.instructions).wont_be_empty
+ @message.instructions.wont_be_empty
@message.instructions = nil
- expect(@message.instructions).must_be_nil
+ @message.instructions.must_be_nil
end
it "can replace the instructions" do
values = random_hash(rand(128) + 1)
@message.instructions = values.clone
- expect(@message.instructions).must_equal(values)
+ @message.instructions.must_equal(values)
values = random_hash(rand(64) + 1)
@message.instructions = values.clone
- expect(@message.instructions).must_equal(values)
+ @message.instructions.must_equal(values)
end
it "can delete the set of instructions" do
values = random_hash(rand(128) + 1)
@message.instructions = values.clone
- expect(@message.instructions).must_equal(values)
+ @message.instructions.must_equal(values)
@message.instructions = nil
- expect(@message.instructions).must_be_nil
+ @message.instructions.must_be_nil
end
it "has no instructions after being cleared" do
value = random_hash(128)
@message.instructions = value.clone
- expect(@message.instructions).must_equal(value)
+ @message.instructions.must_equal(value)
@message.clear
- expect(@message.instructions).must_be_empty
+ @message.instructions.must_be_empty
end
it "has annotations" do
- expect(@message).must_respond_to(:annotations)
- expect(@message).must_respond_to(:annotations=)
+ @message.must_respond_to(:annotations)
+ @message.must_respond_to(:annotations=)
end
it "can set an annotation" do
@@ -511,7 +511,7 @@ module Qpid
value = random_hash(256)
@message.annotations[name] = value.clone
- expect(@message.annotations[name]).must_equal(value)
+ @message.annotations[name].must_equal(value)
end
it "can update an annotation" do
@@ -519,12 +519,12 @@ module Qpid
value = random_hash(256)
@message.annotations[name] = value.clone
- expect(@message.annotations[name]).must_equal(value)
+ @message.annotations[name].must_equal(value)
value = random_hash(128)
@message.annotations[name] = value.clone
- expect(@message.annotations[name]).must_equal(value)
+ @message.annotations[name].must_equal(value)
end
it "can delete an annotation" do
@@ -532,51 +532,51 @@ module Qpid
value = random_hash(256)
@message.annotations[name] = value.clone
- expect(@message.annotations[name]).must_equal(value)
+ @message.annotations[name].must_equal(value)
@message.annotations[name] = nil
- expect(@message.annotations[name]).must_be_nil
+ @message.annotations[name].must_be_nil
end
it "can replace all annotations" do
values = random_hash(rand(128) + 1)
@message.annotations = values.clone
- expect(@message.annotations).must_equal(values)
+ @message.annotations.must_equal(values)
values = random_hash(rand(64) + 1)
@message.annotations = values.clone
- expect(@message.annotations).must_equal(values)
+ @message.annotations.must_equal(values)
end
it "can delete the set of annotations" do
value = random_hash(rand(128) + 1)
@message.annotations = value.clone
- expect(@message.annotations).must_equal(value)
+ @message.annotations.must_equal(value)
@message.annotations = nil
- expect(@message.annotations).must_be_nil
+ @message.annotations.must_be_nil
end
it "has no annotations after being cleared" do
value = random_hash(16)
@message.annotations = value
- expect(@message.annotations).must_equal(value)
+ @message.annotations.must_equal(value)
@message.clear
- expect(@message.annotations).must_be_empty
+ @message.annotations.must_be_empty
end
it "has a body property" do
- expect(@message).must_respond_to(:body)
- expect(@message).must_respond_to(:body=)
+ @message.must_respond_to(:body)
+ @message.must_respond_to(:body=)
end
it "has a default body that is nil" do
- expect(@message.body).must_be_nil
+ @message.body.must_be_nil
end
it "has no body after being cleared" do
@@ -584,10 +584,10 @@ module Qpid
value = random_string(128)
@message.body = value
- expect(@message.body).must_equal(value)
+ @message.body.must_equal(value)
@message.clear
- expect(@message.body).must_be_nil
+ @message.body.must_be_nil
end
it "can set the body property" do
@@ -604,7 +604,7 @@ module Qpid
end
@message.body = value
- expect(@message.body).must_equal(value)
+ @message.body.must_equal(value)
end
end
@@ -622,10 +622,10 @@ module Qpid
end
@message.body = value
- expect(@message.body).must_equal(value)
+ @message.body.must_equal(value)
@message.body = nil
- expect(@message.body).must_be_nil
+ @message.body.must_be_nil
end
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/old_examples/old_example_test.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/old_examples/old_example_test.rb b/proton-c/bindings/ruby/tests/old_examples/old_example_test.rb
index 53a6757..b6700c3 100755
--- a/proton-c/bindings/ruby/tests/old_examples/old_example_test.rb
+++ b/proton-c/bindings/ruby/tests/old_examples/old_example_test.rb
@@ -21,6 +21,13 @@
require 'minitest/autorun'
require 'qpid_proton'
require 'socket'
+require 'rbconfig'
+
+begin
+ MiniTest::Test
+rescue NameError # For older versions of MiniTest
+ MiniTest::Test = MiniTest::Unit::TestCase
+end
def unused_port; TCPServer.open(0) { |s| s.addr[1] } end
def make_url(port, path) "amqp://:#{port}/#{path}"; end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_connection_driver.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_connection_driver.rb b/proton-c/bindings/ruby/tests/test_connection_driver.rb
index ebe6b53..7a6f68d 100644
--- a/proton-c/bindings/ruby/tests/test_connection_driver.rb
+++ b/proton-c/bindings/ruby/tests/test_connection_driver.rb
@@ -16,12 +16,13 @@
require 'test_tools'
+require 'minitest/unit'
include Qpid::Proton
# Test delivery of raw proton events
-class RawDriverTest < Minitest::Test
+class RawDriverTest < MiniTest::Test
# Raw handler to record all on_xxx calls
class RecordingHandler
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_container.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_container.rb b/proton-c/bindings/ruby/tests/test_container.rb
index 71a9f3a..385549b 100644
--- a/proton-c/bindings/ruby/tests/test_container.rb
+++ b/proton-c/bindings/ruby/tests/test_container.rb
@@ -32,7 +32,7 @@ class TestContainer < Qpid::Proton::Container
def url() "amqp://:#{port}"; end#
end
-class ContainerTest < Minitest::Test
+class ContainerTest < MiniTest::Test
include Qpid::Proton
def test_simple()
@@ -215,7 +215,7 @@ class ContainerTest < Minitest::Test
end
-class ContainerSASLTest < Minitest::Test
+class ContainerSASLTest < MiniTest::Test
include Qpid::Proton
# Handler for test client/server that sets up server and client SASL options
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_data.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_data.rb b/proton-c/bindings/ruby/tests/test_data.rb
index b1ae2d9..727f596 100644
--- a/proton-c/bindings/ruby/tests/test_data.rb
+++ b/proton-c/bindings/ruby/tests/test_data.rb
@@ -16,11 +16,11 @@
# under the License.
-require 'minitest/autorun'
+require 'test_tools'
require "securerandom"
require 'qpid_proton'
-class TestData < Minitest::Test
+class TestData < MiniTest::Test
include Qpid::Proton
def assert_from_to(*values)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_delivery.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_delivery.rb b/proton-c/bindings/ruby/tests/test_delivery.rb
index 5f20b58..ee64451 100644
--- a/proton-c/bindings/ruby/tests/test_delivery.rb
+++ b/proton-c/bindings/ruby/tests/test_delivery.rb
@@ -22,7 +22,7 @@ require 'test_tools'
include Qpid::Proton
# Test Delivery and Tracker
-class TestDelivery < Minitest::Test
+class TestDelivery < MiniTest::Test
class NoAutoHandler < MessagingHandler
def on_link_open(l) l.open({:auto_settle=>false, :auto_accept=>false}); end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_interop.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_interop.rb b/proton-c/bindings/ruby/tests/test_interop.rb
index 326b481..a956fc8 100755
--- a/proton-c/bindings/ruby/tests/test_interop.rb
+++ b/proton-c/bindings/ruby/tests/test_interop.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
-require 'minitest/autorun'
-require 'minitest/unit'
+require 'test_tools'
require 'qpid_proton'
if ((RUBY_VERSION.split(".").map {|x| x.to_i} <=> [1, 9]) < 0)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_messaging_adapter.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_messaging_adapter.rb b/proton-c/bindings/ruby/tests/test_messaging_adapter.rb
index 5a2055b..6c683c0 100644
--- a/proton-c/bindings/ruby/tests/test_messaging_adapter.rb
+++ b/proton-c/bindings/ruby/tests/test_messaging_adapter.rb
@@ -56,7 +56,7 @@ class NoAutoOpenClose < RecordingHandler
attr_reader :connection, :session, :link
end
-class TestMessagingHandler < Minitest::Test
+class TestMessagingHandler < MiniTest::Test
def test_auto_open_close
d = DriverPair.new(RecordingHandler.new, RecordingHandler.new)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_old_adapter.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_old_adapter.rb b/proton-c/bindings/ruby/tests/test_old_adapter.rb
index 103efc1..5b052e2 100644
--- a/proton-c/bindings/ruby/tests/test_old_adapter.rb
+++ b/proton-c/bindings/ruby/tests/test_old_adapter.rb
@@ -41,7 +41,7 @@ class AllHandler < OldMessagingHandler
end
# Tests with Mock handler that handles all methods, expect both old and new calls
-class TestOldHandler < Minitest::Test
+class TestOldHandler < MiniTest::Test
def setup
@h = [AllHandler.new, AllHandler.new]
@ch, @sh = *@h
@@ -161,7 +161,7 @@ class TestOldHandler < Minitest::Test
end
# Test with real handlers that implement a few methods
-class TestOldUnhandled < Minitest::Test
+class TestOldUnhandled < MiniTest::Test
def test_message
handler_class = Class.new(OldMessagingHandler) do
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_tools.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_tools.rb b/proton-c/bindings/ruby/tests/test_tools.rb
index a5b3b75..5907070 100644
--- a/proton-c/bindings/ruby/tests/test_tools.rb
+++ b/proton-c/bindings/ruby/tests/test_tools.rb
@@ -20,9 +20,14 @@
require 'minitest/autorun'
require 'qpid_proton'
-require 'thread'
require 'socket'
+begin
+ MiniTest::Test
+rescue NameError # For older versions of MiniTest
+ MiniTest::Test = MiniTest::Unit::TestCase
+end
+
class TestError < Exception; end
def wait_port(port, timeout=5)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/71e8c7b2/proton-c/bindings/ruby/tests/test_uri.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_uri.rb b/proton-c/bindings/ruby/tests/test_uri.rb
index 7af2ea2..c531371 100644
--- a/proton-c/bindings/ruby/tests/test_uri.rb
+++ b/proton-c/bindings/ruby/tests/test_uri.rb
@@ -16,10 +16,10 @@
# under the License.
-require 'minitest/autorun'
+require 'test_tools'
require 'qpid_proton'
-class TestURI < Minitest::Test
+class TestURI < MiniTest::Test
PARTS=[:scheme, :userinfo, :host, :port, :path] # Interesting URI components
def uri(u) Qpid::Proton::uri(u); end
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org