From fd3c06177dbb4e7700094b9078975e18a4f241ff Mon Sep 17 00:00:00 2001 From: Kubo Takehiro Date: Tue, 2 Jan 2024 15:44:46 +0900 Subject: [PATCH] Fix tests for Oracle 23 --- lib/oci8.rb | 2 ++ test/test_oranumber.rb | 4 +++- test/test_package_type.rb | 14 ++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/oci8.rb b/lib/oci8.rb index f6ad02b4..068a9ce6 100644 --- a/lib/oci8.rb +++ b/lib/oci8.rb @@ -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) diff --git a/test/test_oranumber.rb b/test/test_oranumber.rb index f116ae7e..8581cf9f 100644 --- a/test/test_oranumber.rb +++ b/test/test_oranumber.rb @@ -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 diff --git a/test/test_package_type.rb b/test/test_package_type.rb index 95202183..d4397338 100644 --- a/test/test_package_type.rb +++ b/test/test_package_type.rb @@ -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, @@ -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, @@ -137,7 +143,7 @@ def test_describe_package :package_name => nil, :type_attrs => [], #:type_methods => [], - :inspect => '#', # TODO: change to "BOOLEAN" + :inspect => "#", } varchar2_type_attrs = { @@ -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 => '#', @@ -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,