Skip to content

Commit c732fde

Browse files
committed
SKip decimal tests on Windows
1 parent 749f865 commit c732fde

File tree

3 files changed

+99
-101
lines changed

3 files changed

+99
-101
lines changed

test/adbc_connection_test.exs

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ defmodule Adbc.ConnectionTest do
55
alias Adbc.Connection
66

77
setup tags do
8-
case Map.get(tags, :driver, :sqlite) do
9-
:sqlite ->
10-
%{db: start_supervised!({Adbc.Database, driver: :sqlite, uri: ":memory:"})}
11-
12-
:duckdb ->
13-
%{db: start_supervised!({Adbc.Database, driver: :duckdb})}
14-
end
8+
%{db: start_supervised!({Adbc.Database, driver: :sqlite, uri: ":memory:"})}
159
end
1610

1711
describe "start_link" do
@@ -739,96 +733,4 @@ defmodule Adbc.ConnectionTest do
739733
{:ok, %{}} = Connection.get_table_types(conn)
740734
end
741735
end
742-
743-
describe "duckdb array handling" do
744-
@describetag driver: :duckdb
745-
test "handles empty string arrays without crashing", %{db: db} do
746-
conn = start_supervised!({Connection, database: db})
747-
748-
# Create a table with array column containing empty arrays
749-
{:ok, _} =
750-
Connection.query(conn, """
751-
CREATE TABLE test_arrays (
752-
number INTEGER,
753-
array_of_text TEXT[]
754-
)
755-
""")
756-
757-
# # Insert data with empty arrays
758-
{:ok, _} =
759-
Connection.query(conn, """
760-
INSERT INTO test_arrays VALUES
761-
(1, LIST_VALUE()),
762-
(2, '["hello", "world"]'),
763-
(4, '["single"]')
764-
""")
765-
766-
assert results =
767-
%Adbc.Result{
768-
num_rows: 0,
769-
data: [
770-
%Adbc.Column{
771-
name: "number",
772-
type: :s32,
773-
nullable: true,
774-
metadata: nil
775-
},
776-
%Adbc.Column{
777-
name: "array_of_text",
778-
type:
779-
{:list,
780-
%Adbc.Column{
781-
name: "item",
782-
type: :string,
783-
nullable: true,
784-
metadata: nil
785-
}},
786-
nullable: true,
787-
metadata: nil
788-
}
789-
]
790-
} = Connection.query!(conn, "SELECT * FROM test_arrays ORDER BY number")
791-
792-
assert %Adbc.Result{
793-
data: [
794-
%Adbc.Column{
795-
name: "number",
796-
type: :s32,
797-
nullable: true,
798-
metadata: nil,
799-
data: [1, 2, 4]
800-
},
801-
%Adbc.Column{
802-
name: "array_of_text",
803-
type: :list,
804-
nullable: true,
805-
metadata: nil,
806-
data: [
807-
%Adbc.Column{
808-
name: "item",
809-
type: :string,
810-
nullable: true,
811-
metadata: nil,
812-
data: []
813-
},
814-
%Adbc.Column{
815-
name: "item",
816-
type: :string,
817-
nullable: true,
818-
metadata: nil,
819-
data: ["hello", "world"]
820-
},
821-
%Adbc.Column{
822-
name: "item",
823-
type: :string,
824-
nullable: true,
825-
metadata: nil,
826-
data: ["single"]
827-
}
828-
]
829-
}
830-
]
831-
} = Adbc.Result.materialize(results)
832-
end
833-
end
834736
end

test/adbc_duckdb_test.exs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ defmodule Adbc.DuckDBTest do
5252
} = Adbc.Connection.query!(conn, "SELECT struct_pack(col1 := 1, col2 := 2)")
5353
end
5454

55+
@tag :unix
5556
test "decimal128", %{conn: conn} do
5657
d1 = Decimal.new("1.2345678912345678912345678912345678912")
5758
d2 = Decimal.new("-1.2345678912345678912345678912345678912")
@@ -174,4 +175,93 @@ defmodule Adbc.DuckDBTest do
174175
]
175176
} = Adbc.Result.materialize(results)
176177
end
178+
179+
@tag :unix
180+
@describetag driver: :duckdb
181+
test "array handling", %{conn: conn} do
182+
# Create a table with array column containing empty arrays
183+
{:ok, _} =
184+
Connection.query(conn, """
185+
CREATE TABLE test_arrays (
186+
number INTEGER,
187+
array_of_text TEXT[]
188+
)
189+
""")
190+
191+
# # Insert data with empty arrays
192+
{:ok, _} =
193+
Connection.query(conn, """
194+
INSERT INTO test_arrays VALUES
195+
(1, LIST_VALUE()),
196+
(2, '["hello", "world"]'),
197+
(4, '["single"]')
198+
""")
199+
200+
assert results =
201+
%Adbc.Result{
202+
num_rows: 0,
203+
data: [
204+
%Adbc.Column{
205+
name: "number",
206+
type: :s32,
207+
nullable: true,
208+
metadata: nil
209+
},
210+
%Adbc.Column{
211+
name: "array_of_text",
212+
type:
213+
{:list,
214+
%Adbc.Column{
215+
name: "item",
216+
type: :string,
217+
nullable: true,
218+
metadata: nil
219+
}},
220+
nullable: true,
221+
metadata: nil
222+
}
223+
]
224+
} = Connection.query!(conn, "SELECT * FROM test_arrays ORDER BY number")
225+
226+
assert %Adbc.Result{
227+
data: [
228+
%Adbc.Column{
229+
name: "number",
230+
type: :s32,
231+
nullable: true,
232+
metadata: nil,
233+
data: [1, 2, 4]
234+
},
235+
%Adbc.Column{
236+
name: "array_of_text",
237+
type: :list,
238+
nullable: true,
239+
metadata: nil,
240+
data: [
241+
%Adbc.Column{
242+
name: "item",
243+
type: :string,
244+
nullable: true,
245+
metadata: nil,
246+
data: []
247+
},
248+
%Adbc.Column{
249+
name: "item",
250+
type: :string,
251+
nullable: true,
252+
metadata: nil,
253+
data: ["hello", "world"]
254+
},
255+
%Adbc.Column{
256+
name: "item",
257+
type: :string,
258+
nullable: true,
259+
metadata: nil,
260+
data: ["single"]
261+
}
262+
]
263+
}
264+
]
265+
} = Adbc.Result.materialize(results)
266+
end
177267
end

test/test_helper.exs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
Adbc.download_driver!(:sqlite)
22
Adbc.download_driver!(:duckdb)
33

4-
exclude =
4+
pg_exclude =
55
if System.find_executable("psql") do
66
Adbc.download_driver!(:postgresql)
77
[]
88
else
99
[:postgresql]
1010
end
1111

12-
ExUnit.start(exclude: exclude)
12+
windows_exclude =
13+
case :os.type() do
14+
{:win32, _} -> [:unix]
15+
_ -> []
16+
end
17+
18+
ExUnit.start(exclude: pg_exclude ++ windows_exclude)

0 commit comments

Comments
 (0)