Skip to content

Commit

Permalink
Fix tests for Oracle 23
Browse files Browse the repository at this point in the history
  • Loading branch information
kubo committed Jan 2, 2024
1 parent 8353c9e commit fd3c061
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/oci8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class OCI8
ORAVER_12_1 = OCI8::OracleVersion.new(12, 1)
# @private
ORAVER_18 = OCI8::OracleVersion.new(18)
# @private
ORAVER_23 = OCI8::OracleVersion.new(23)

# @private
@@oracle_client_version = OCI8::OracleVersion.new(self.oracle_client_vernum)
Expand Down
4 changes: 3 additions & 1 deletion test/test_oranumber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,9 @@ def run_test_new_from_string(cursor, str)
OraNumber.new(str)
flunk("exception expected but none was thrown. test data: " + str)
rescue
assert_equal(oraerr.to_s, $!.to_s, "test data: " + str)
expected_errhead = oraerr.to_s.gsub(/:.*/m, '') # strip chars after ':'
actual_errhead = $!.to_s.gsub(/:.*/m, '')
assert_equal(expected_errhead, actual_errhead, "test data: " + str)
end
end
if onum
Expand Down
14 changes: 10 additions & 4 deletions test/test_package_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def check_attributes(msg, obj, attrs)
end

def test_describe_package
if $oracle_server_version >= OCI8::ORAVER_23
boolean_type_name = 'BOOLEAN'
else
boolean_type_name = 'PL/SQL BOOLEAN'
end

integer_type_attrs = {
:class => OCI8::Metadata::Type,
#:typecode => nil,
Expand Down Expand Up @@ -127,7 +133,7 @@ def test_describe_package
#:map_method => nil,
#:order_method => nil,
:is_invoker_rights? => false,
:name => 'PL/SQL BOOLEAN',
:name => boolean_type_name,
:schema_name => 'SYS',
:is_final_type? => true,
:is_instantiable_type? => true,
Expand All @@ -137,7 +143,7 @@ def test_describe_package
:package_name => nil,
:type_attrs => [],
#:type_methods => [],
:inspect => '#<OCI8::Metadata::Type:(0) SYS.PL/SQL BOOLEAN>', # TODO: change to "BOOLEAN"
:inspect => "#<OCI8::Metadata::Type:(0) SYS.#{boolean_type_name}>",
}

varchar2_type_attrs = {
Expand Down Expand Up @@ -277,7 +283,7 @@ def test_describe_package
:num_elems => 0,
:precision => 0,
:scale => 0,
:type_name => 'PL/SQL BOOLEAN',
:type_name => boolean_type_name,
:schema_name => 'SYS',
:type_metadata => boolean_type_attrs,
:inspect => '#<OCI8::Metadata::Collection: BOOLEAN>',
Expand Down Expand Up @@ -444,7 +450,7 @@ def test_describe_package
:name => 'B',
:precision => 0,
:scale => 0,
:type_name => 'PL/SQL BOOLEAN',
:type_name => boolean_type_name,
:schema_name => 'SYS',
:fsprecision => 0,
:lfprecision => 0,
Expand Down

0 comments on commit fd3c061

Please sign in to comment.