Commit c6b2b97f authored by Kubo Takehiro's avatar Kubo Takehiro
Browse files

Suppress warnings: "Use assert_nil if expecting nil from ... in `...' This...

Suppress warnings: "Use assert_nil if expecting nil from ... in `...' This will fail in MT6" printed by Minitest.
parent 3d4a76b3
2016-12-26 Kubo Takehiro <kubo@jiubao.org>
* test/test_clob.rb, test/test_metadata.rb, test/test_object.rb,
test/test_oci8.rb, test/test_package_type.rb: Suppress warnings:
"Use assert_nil if expecting nil from ... in `...' This will
fail in MT6" printed by Minitest.
2016-12-26 Kubo Takehiro <kubo@jiubao.org>
* lib/oci8/bindtype.rb, lib/oci8/compat.rb, lib/oci8/oci8.rb,
test/config.rb: Suppress "warning: constant ::Fixnum is deprecated"
......
......@@ -67,7 +67,7 @@ class TestCLob < Minitest::Test
# Though buf.size counts in byte,
# offset and $lobreadnum count in character.
end
assert_equal(nil, buf)
assert_nil(buf)
assert(f.eof?)
assert(lob.eof?)
end
......
......@@ -42,6 +42,8 @@ class TestMetadata < Minitest::Test
assert(expected_value.call(val), "#{msg} > #{method}")
when Regexp
assert_match(expected_value, val, "#{msg} > #{method}")
when nil
assert_nil(val, "#{msg} > #{method}")
else
assert_equal(expected_value, val, "#{msg} > #{method}")
end
......@@ -1335,7 +1337,6 @@ EOS
drop_type('TEST_TYPE_NESTEAD_TABLE')
drop_type('TEST_TYPE_CHILD')
drop_type('TEST_TYPE_PARENT')
expected_values = []
attrs_map = {}
@conn.exec(<<-EOS)
......
......@@ -237,15 +237,35 @@ class TestObj1 < Minitest::Test
assert_equal(@nclob_val, nclob_val)
assert_equal(@blob_val, blob_val)
assert_equal(@obj_val, obj_val)
assert_equal(@int_array_val, int_array_val && int_array_val.to_ary)
if @int_array_val
assert_equal(@int_array_val, int_array_val.to_ary)
else
assert_nil(@int_array_val, int_array_val)
end
assert_array_in_delta(@flt_array_val, flt_array_val && flt_array_val.to_ary)
assert_array_in_delta(@num_array_val, num_array_val && num_array_val.to_ary)
assert_array_in_delta(@bdbl_array_val, bdbl_array_val && bdbl_array_val.to_ary)
assert_array_in_delta(@bflt_array_val, bflt_array_val && bflt_array_val.to_ary)
assert_equal(@str_array_val, str_array_val && str_array_val.to_ary)
assert_equal(@raw_array_val, raw_array_val && raw_array_val.to_ary)
assert_equal(@obj_array_val, obj_array_val && obj_array_val.to_ary)
assert_equal(@obj_ary_of_ary_val, obj_ary_of_ary_val && obj_ary_of_ary_val.to_ary.collect { |elem| elem.to_ary })
if @str_array_val
assert_equal(@str_array_val, str_array_val.to_ary)
else
assert_nil(str_array_val)
end
if @raw_array_val
assert_equal(@raw_array_val, raw_array_val.to_ary)
else
assert_nil(raw_array_val)
end
if @obj_array_val
assert_equal(@obj_array_val, obj_array_val.to_ary)
else
assert_nil(obj_array_val)
end
if @obj_ary_of_ary_val
assert_equal(@obj_ary_of_ary_val, obj_ary_of_ary_val.to_ary.collect { |elem| elem.to_ary })
else
assert_nil(obj_ary_of_ary_val)
end
assert_equal(@date_val, date_val)
# assert_equal(@date_array_val, date_array_val && date_array_val.to_ary)
end
......@@ -256,6 +276,8 @@ class TestObj1 < Minitest::Test
exp.each_with_index do |elem, idx|
assert_in_delta(elem, val[idx], Delta)
end
elsif exp.nil?
assert_nil(val)
else
assert_equal(exp, val)
end
......@@ -456,10 +478,26 @@ EOS
csr.bind_param(:out2, nil, Integer)
csr.bind_param(:out3, nil, Integer)
csr.exec
assert_equal(ary ? ary.length : -1, csr[:cnt])
assert_equal(ary ? ary[0] : nil, csr[:out1])
assert_equal(ary ? ary[1] : nil, csr[:out2])
assert_equal(ary ? ary[2] : nil, csr[:out3])
if ary
assert_equal(ary.length, csr[:cnt])
else
assert_equal(-1, csr[:cnt])
end
if ary && ary[0]
assert_equal(ary[0], csr[:out1])
else
assert_nil(csr[:out1])
end
if ary && ary[1]
assert_equal(ary[1], csr[:out2])
else
assert_nil(csr[:out2])
end
if ary && ary[2]
assert_equal(ary[2], csr[:out3])
else
assert_nil(csr[:out3])
end
end
end
......
......@@ -69,7 +69,7 @@ EOS
cursor.exec
assert_equal(test_data1, cursor.fetch[0])
assert_equal(test_data2, cursor.fetch[0])
assert_equal(test_data3, cursor.fetch[0])
assert_nil(cursor.fetch[0])
assert_equal(test_data4, cursor.fetch[0])
cursor.close
drop_table('test_table')
......
......@@ -38,6 +38,8 @@ class TestPackageType < Minitest::Test
val = method.is_a?(Array) ? obj[method[0]] : obj.send(method)
if expected_value.is_a? Hash
check_attributes("#{msg} > #{method}", val, expected_value)
elsif expected_value.nil?
assert_nil(val, "#{msg} > #{method}")
else
assert_equal(expected_value, val, "#{msg} > #{method}")
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment