Skip to content

Commit

Permalink
Added tests for JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 6, 2024
1 parent c7a55ef commit bc1dbc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/adapters/mysql_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def test_binary_output
assert_result [{"hello" => "0xF6"}], "SELECT UNHEX('F6') AS hello"
end

def test_json_output
assert_result [{"json" => '{"hello": "world"}'}], %!SELECT JSON_OBJECT('hello', 'world') AS json!
end

private

def prepared_statements?
Expand Down
8 changes: 8 additions & 0 deletions test/adapters/postgresql_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,12 @@ def test_quoted
def test_binary_output
assert_result [{"bytea" => "\\x68656c6c6f"}], "SELECT 'hello'::bytea"
end

def test_json_output
assert_result [{"json" => '{"hello": "world"}'}], %!SELECT '{"hello": "world"}'::json!
end

def test_jsonb_output
assert_result [{"jsonb" => '{"hello": "world"}'}], %!SELECT '{"hello": "world"}'::jsonb!
end
end

0 comments on commit bc1dbc1

Please sign in to comment.