Skip to content

Commit 44c813f

Browse files
committed
Apply formatter fixes to all modified files
1 parent 36795a0 commit 44c813f

14 files changed

Lines changed: 79 additions & 252 deletions

COMPATIBILITY_TEST_FIXES.md

Lines changed: 0 additions & 197 deletions
This file was deleted.

lib/ecto/adapters/libsql.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ defmodule Ecto.Adapters.LibSql do
280280

281281
defp json_array_decode(value) when is_binary(value) do
282282
case value do
283-
"" -> {:ok, []} # Empty string defaults to empty array
283+
# Empty string defaults to empty array
284+
"" ->
285+
{:ok, []}
286+
284287
_ ->
285288
case Jason.decode(value) do
286289
{:ok, decoded} when is_list(decoded) -> {:ok, decoded}
@@ -335,12 +338,14 @@ defmodule Ecto.Adapters.LibSql do
335338
end
336339

337340
defp json_encode(value) when is_binary(value), do: {:ok, value}
341+
338342
defp json_encode(value) when is_map(value) or is_list(value) do
339343
case Jason.encode(value) do
340344
{:ok, json} -> {:ok, json}
341345
{:error, _} -> :error
342346
end
343347
end
348+
344349
defp json_encode(value), do: {:ok, value}
345350

346351
defp array_encode(value) when is_list(value) do
@@ -349,5 +354,6 @@ defmodule Ecto.Adapters.LibSql do
349354
{:error, _} -> :error
350355
end
351356
end
357+
352358
defp array_encode(value), do: {:ok, value}
353359
end

test/ecto_returning_shared_schema_test.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ defmodule EctoLibSql.EctoReturningSharedSchemaTest do
99
use Ecto.Repo, otp_app: :ecto_libsql, adapter: Ecto.Adapters.LibSql
1010
end
1111

12-
alias EctoLibSql.Schemas.User # Using shared schema
12+
# Using shared schema
13+
alias EctoLibSql.Schemas.User
1314

1415
@test_db "z_ecto_libsql_test-shared_schema_returning.db"
1516

@@ -36,7 +37,7 @@ defmodule EctoLibSql.EctoReturningSharedSchemaTest do
3637

3738
test "insert shared schema user and get ID back" do
3839
IO.puts("\n=== Testing Shared Schema Insert RETURNING ===")
39-
40+
4041
result = LocalTestRepo.insert(%User{name: "Alice"})
4142
IO.inspect(result, label: "Insert result")
4243

test/ecto_returning_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ defmodule EctoLibSql.EctoReturningStructTest do
1010
import Ecto.Changeset
1111

1212
schema "users" do
13-
field :name, :string
14-
field :email, :string
13+
field(:name, :string)
14+
field(:email, :string)
1515
timestamps()
1616
end
1717

@@ -56,7 +56,7 @@ defmodule EctoLibSql.EctoReturningStructTest do
5656
case result do
5757
{:ok, user} ->
5858
IO.inspect(user, label: "Returned user struct")
59-
59+
6060
# These assertions should pass if RETURNING struct mapping works
6161
assert user.id != nil, "❌ FAIL: ID is nil (struct mapping broken)"
6262
assert is_integer(user.id) and user.id > 0, "ID should be positive integer"

test/ecto_sqlite3_blob_compat_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule EctoLibSql.EctoSqlite3BlobCompatTest do
22
@moduledoc """
33
Compatibility tests based on ecto_sqlite3 blob test suite.
4-
4+
55
These tests ensure that binary/blob field handling works identically to ecto_sqlite3.
66
"""
77

@@ -19,7 +19,7 @@ defmodule EctoLibSql.EctoSqlite3BlobCompatTest do
1919
setup_all do
2020
# Clean up any existing test database
2121
EctoLibSql.TestHelpers.cleanup_db_files(@test_db)
22-
22+
2323
# Configure the repo
2424
Application.put_env(:ecto_libsql, TestRepo,
2525
adapter: Ecto.Adapters.LibSql,

test/ecto_sqlite3_crud_compat_fixed_test.exs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ defmodule EctoLibSql.EctoSqlite3CrudCompatFixedTest do
8888

8989
test "insert user returns populated struct with id" do
9090
{:ok, user} = TestRepo.insert(%User{name: "Alice"})
91-
91+
9292
assert user.id != nil, "User ID should not be nil"
9393
assert user.name == "Alice"
9494
assert user.inserted_at != nil
@@ -97,13 +97,14 @@ defmodule EctoLibSql.EctoSqlite3CrudCompatFixedTest do
9797

9898
test "insert account and product" do
9999
{:ok, account} = TestRepo.insert(%Account{name: "TestAccount"})
100-
100+
101101
assert account.id != nil
102102

103-
{:ok, product} = TestRepo.insert(%Product{
104-
name: "TestProduct",
105-
account_id: account.id
106-
})
103+
{:ok, product} =
104+
TestRepo.insert(%Product{
105+
name: "TestProduct",
106+
account_id: account.id
107+
})
107108

108109
assert product.id != nil
109110
assert product.account_id == account.id
@@ -119,17 +120,17 @@ defmodule EctoLibSql.EctoSqlite3CrudCompatFixedTest do
119120

120121
test "update user" do
121122
{:ok, user} = TestRepo.insert(%User{name: "Charlie"})
122-
123+
123124
changeset = User.changeset(user, %{name: "Charles"})
124125
{:ok, updated} = TestRepo.update(changeset)
125-
126+
126127
assert updated.name == "Charles"
127128
end
128129

129130
test "delete user" do
130131
{:ok, user} = TestRepo.insert(%User{name: "David"})
131132
{:ok, _} = TestRepo.delete(user)
132-
133+
133134
assert TestRepo.get(User, user.id) == nil
134135
end
135136
end

test/ecto_sqlite3_crud_compat_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule EctoLibSql.EctoSqlite3CrudCompatTest do
22
@moduledoc """
33
Compatibility tests based on ecto_sqlite3 CRUD test suite.
4-
4+
55
These tests ensure that ecto_libsql adapter behaves identically to ecto_sqlite3
66
for basic CRUD operations.
77
"""

test/ecto_sqlite3_json_compat_test.exs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule EctoLibSql.EctoSqlite3JsonCompatTest do
22
@moduledoc """
33
Compatibility tests based on ecto_sqlite3 JSON test suite.
4-
4+
55
These tests ensure that JSON/MAP field serialization and deserialization
66
works identically to ecto_sqlite3.
77
"""
@@ -20,7 +20,7 @@ defmodule EctoLibSql.EctoSqlite3JsonCompatTest do
2020
setup_all do
2121
# Clean up any existing test database
2222
EctoLibSql.TestHelpers.cleanup_db_files(@test_db)
23-
23+
2424
# Configure the repo
2525
Application.put_env(:ecto_libsql, TestRepo,
2626
adapter: Ecto.Adapters.LibSql,
@@ -105,13 +105,13 @@ defmodule EctoLibSql.EctoSqlite3JsonCompatTest do
105105
end
106106

107107
test "json field with nil" do
108-
changeset =
108+
changeset =
109109
%Setting{}
110110
|> Setting.changeset(%{properties: nil})
111111
|> Ecto.Changeset.force_change(:properties, nil)
112-
112+
113113
IO.inspect(changeset, label: "Changeset before insert")
114-
114+
115115
setting = TestRepo.insert!(changeset)
116116

117117
fetched = TestRepo.get(Setting, setting.id)

0 commit comments

Comments
 (0)