Skip to content

Commit

Permalink
Make PostgreSQL specs pass when PostgreSQL is not built with libxml s…
Browse files Browse the repository at this point in the history
…upport

This seems an uncommon way to build PostgreSQL, considering that
nobody has reported this issue, but since libxml is not required
to build PostgreSQL, Sequel's specs should work without it.
  • Loading branch information
jeremyevans committed Dec 18, 2024
1 parent cc4a0ff commit eba1a8e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions spec/adapters/postgres_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3214,7 +3214,18 @@ def c.get_last_result; end
column :o, 'oidvector[]'
end
@tp.call.must_equal [:xml_array, :money_array, :bit_array, :varbit_array, :uuid_array, :xid_array, :cid_array, :name_array, :oidvector_array]
@ds.insert(Sequel.pg_array(['<a></a>'], :xml),

begin
@db.transaction(:rollback=>:always) do
@ds.insert(:x=>Sequel.pg_array(['<a></a>'], :xml))
end
rescue Sequel::DatabaseError
else
xml_insert_value = Sequel.pg_array(['<a></a>'], :xml)
xml_expected_value = ['<a></a>']
end

@ds.insert(xml_insert_value,
Sequel.pg_array(['1'], :money),
Sequel.pg_array(['1'], :bit),
Sequel.pg_array(['10'], :varbit),
Expand All @@ -3230,10 +3241,12 @@ def c.get_last_result; end
m.class.must_equal(Sequel::Postgres::PGArray)
m.to_a.must_be_kind_of(Array)
m.first.must_be_kind_of(String)
r.must_be(:==, :x=>['<a></a>'], :b=>['1'], :vb=>['10'], :u=>['c0f24910-39e7-11e4-916c-0800200c9a66'], :xi=>['12'], :c=>['12'], :n=>['N'], :o=>['1 2'])
rs.first.values.each{|v| v.class.must_equal(Sequel::Postgres::PGArray)}
rs.first.values.each{|v| v.to_a.must_be_kind_of(Array)}
r.must_be(:==, :x=>xml_expected_value, :b=>['1'], :vb=>['10'], :u=>['c0f24910-39e7-11e4-916c-0800200c9a66'], :xi=>['12'], :c=>['12'], :n=>['N'], :o=>['1 2'])
x = r.delete(:x)
r.values.each{|v| v.class.must_equal(Sequel::Postgres::PGArray)}
r.values.each{|v| v.to_a.must_be_kind_of(Array)}
r[:m] = m
r[:x] = x
@ds.delete
@ds.insert(r)
@ds.all.must_equal rs
Expand Down

0 comments on commit eba1a8e

Please sign in to comment.