@@ -4,11 +4,15 @@ defmodule Ecto.Adapters.SQLite3.DataTypeTest do
44 alias Ecto.Adapters.SQLite3.DataType
55
66 setup do
7+ Application . put_env ( :ecto_sqlite3 , :array_type , :string )
78 Application . put_env ( :ecto_sqlite3 , :binary_id_type , :string )
9+ Application . put_env ( :ecto_sqlite3 , :map_type , :string )
810 Application . put_env ( :ecto_sqlite3 , :uuid_type , :string )
911
1012 on_exit ( fn ->
13+ Application . put_env ( :ecto_sqlite3 , :array_type , :string )
1114 Application . put_env ( :ecto_sqlite3 , :binary_id_type , :string )
15+ Application . put_env ( :ecto_sqlite3 , :map_type , :string )
1216 Application . put_env ( :ecto_sqlite3 , :uuid_type , :string )
1317 end )
1418 end
@@ -46,20 +50,36 @@ defmodule Ecto.Adapters.SQLite3.DataTypeTest do
4650 assert DataType . column_type ( :uuid , nil ) == "BLOB"
4751 end
4852
49- test ":map is TEXT" do
53+ test ":map is TEXT or BLOB " do
5054 assert DataType . column_type ( :map , nil ) == "TEXT"
55+
56+ Application . put_env ( :ecto_sqlite3 , :map_type , :binary )
57+
58+ assert DataType . column_type ( :map , nil ) == "BLOB"
5159 end
5260
53- test "{:map, _} is TEXT" do
61+ test "{:map, _} is TEXT or BLOB " do
5462 assert DataType . column_type ( { :map , % { } } , nil ) == "TEXT"
63+
64+ Application . put_env ( :ecto_sqlite3 , :map_type , :binary )
65+
66+ assert DataType . column_type ( { :map , % { } } , nil ) == "BLOB"
5567 end
5668
57- test ":array is TEXT" do
69+ test ":array is TEXT or BLOB " do
5870 assert DataType . column_type ( :array , nil ) == "TEXT"
71+
72+ Application . put_env ( :ecto_sqlite3 , :array_type , :binary )
73+
74+ assert DataType . column_type ( :array , nil ) == "BLOB"
5975 end
6076
61- test "{:array, _} is TEXT" do
77+ test "{:array, _} is TEXT or BLOB " do
6278 assert DataType . column_type ( { :array , [ ] } , nil ) == "TEXT"
79+
80+ Application . put_env ( :ecto_sqlite3 , :array_type , :binary )
81+
82+ assert DataType . column_type ( { :array , [ ] } , nil ) == "BLOB"
6383 end
6484
6585 test ":float is NUMERIC" do
0 commit comments