test/unit/util/test_query.rb in sup-0.22.1 vs test/unit/util/test_query.rb in sup-0.23
- old
+ new
@@ -22,13 +22,18 @@
it "returns a valid UTF-8 description of bad input" do
msg = "asdfa \xc3\x28 åasdf"
query = Xapian::Query.new msg
life = 'hæi'
- # this is now possibly UTF-8 string with possibly invalid chars
- assert_raises Redwood::Util::Query::QueryDescriptionError do
- desc = Redwood::Util::Query.describe (query)
+ if query.description.force_encoding("UTF-8").valid_encoding?
+ # xapian 1.4 internally handles this bad input
+ assert true
+ else
+ # xapian 1.2 doesn't handle this bad input, so we do
+ assert_raises Redwood::Util::Query::QueryDescriptionError do
+ desc = Redwood::Util::Query.describe (query)
+ end
end
assert_raises Encoding::CompatibilityError do
_ = life + query.description
end
@@ -38,9 +43,10 @@
msg = "asdfa \xc3\x28 åasdf"
query = Xapian::Query.new msg
desc = Redwood::Util::Query.describe(query, "invalid query")
- assert_equal("invalid query", desc)
+ assert desc.force_encoding("UTF-8").valid_encoding?
+
end
end
end