Browse files

iconv is deprecated on 1.9, so stop using it

  • Loading branch information...
1 parent 73b60d7 commit caa0b16dad18ff05811793cace565a7828ffee72 @tenderlove tenderlove committed Mar 3, 2012
Showing with 10 additions and 3 deletions.
  1. +4 −1 test/helper.rb
  2. +6 −2 test/test_database.rb
View
5 test/helper.rb
@@ -1,6 +1,9 @@
require 'sqlite3'
require 'test/unit'
-require 'iconv'
+
+unless RUBY_VERSION >= "1.9"
+ require 'iconv'
+end
module SQLite3
class TestCase < Test::Unit::TestCase
View
8 test/test_database.rb
@@ -77,8 +77,12 @@ def test_new_with_options
# determine if Ruby is running on Big Endian platform
utf16 = ([1].pack("I") == [1].pack("N")) ? "UTF-16BE" : "UTF-16LE"
- db = SQLite3::Database.new(Iconv.conv(utf16, 'UTF-8', ':memory:'),
- :utf16 => true)
+ if RUBY_VERSION >= "1.9"
+ db = SQLite3::Database.new(':memory:'.encode(utf16), :utf16 => true)
+ else
+ db = SQLite3::Database.new(Iconv.conv(utf16, 'UTF-8', ':memory:'),
+ :utf16 => true)
+ end
assert db
end

0 comments on commit caa0b16

Please sign in to comment.