Skip to content

Commit

Permalink
Merge branch 'main' into secure_memset
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvCW authored Jul 19, 2023
2 parents 6b3676a + 61a8b40 commit 6b65a56
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions contrib/ruby/lib/trilogy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class Trilogy
def initialize(options = {})
options[:port] = options[:port].to_i if options.key?(:port)
mysql_encoding = options[:encoding] || "utf8mb4"
encoding = Trilogy::Encoding.find(mysql_encoding)
charset = Trilogy::Encoding.charset(mysql_encoding)
Expand Down
19 changes: 13 additions & 6 deletions contrib/ruby/test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ def test_trilogy_connect_with_native_password_auth_switch
ensure_closed client
end

def test_trilogy_connect_tcp_fixnum_port
assert_raises TypeError do
new_tcp_client port: "13306"
end
end

def test_trilogy_connect_tcp_to_wrong_port
e = assert_raises Trilogy::ConnectionError do
new_tcp_client port: 13307
Expand Down Expand Up @@ -1057,4 +1051,17 @@ def test_character_encoding_handles_binary_queries
assert_equal expected.dup.force_encoding(Encoding::Windows_31J), result
assert_equal Encoding::Windows_31J, result.encoding
end

def test_connection_options_casting
options = {
host: DEFAULT_HOST,
port: DEFAULT_PORT.to_s,
username: DEFAULT_USER,
password: DEFAULT_PASS,
ssl: "1",
}
client = new_tcp_client(**options)

assert client.query("SELECT 1")
end
end

0 comments on commit 6b65a56

Please sign in to comment.