|
1 | 1 | using QuerySQLite |
2 | 2 |
|
3 | 3 | using DataValues: DataValue |
4 | | -using Dates: Date, DateTime, Time |
| 4 | +using Dates: Date, DateTime, format, Time |
5 | 5 | using Documenter: doctest |
6 | 6 | using Query |
7 | 7 | using QueryTables |
@@ -125,10 +125,18 @@ execute!(Stmt(connection, """ |
125 | 125 | execute!(Stmt(connection, """ |
126 | 126 | INSERT INTO test VALUES(0, 1, -1, "ab", NULL, 65, "b", " a ", "_a_", 1.11, "2019-12-08", "2019-12-08T11:09:00", "11:09:00") |
127 | 127 | """)) |
128 | | -database = Database(connection) |
| 128 | +small = Database(connection) |
| 129 | + |
| 130 | +@test (small.test |> |
| 131 | + @groupby(_.zero) |> |
| 132 | + @map({ |
| 133 | + join_test = join(_.ab) |
| 134 | + }) |> |
| 135 | + collect |> |
| 136 | + first).join_test == "ab" |
129 | 137 |
|
130 | 138 | result = |
131 | | - database.test |> |
| 139 | + small.test |> |
132 | 140 | @map({ |
133 | 141 | equals_test = _.zero == _.one, |
134 | 142 | not_equals_test = _.zero != _.one, |
@@ -170,9 +178,12 @@ result = |
170 | 178 | SubString_test_1 = SubString(_.ab, 2, 2), |
171 | 179 | SubString_test_2 = SubString(_.ab, 2), |
172 | 180 | random_test = rand(BySQL(_), Int), |
| 181 | + # TODO: fix |
| 182 | + # randstring_test = randstring(BySQL(_), 4), |
173 | 183 | date_test = Date(_.date_text), |
174 | 184 | datetime_test = DateTime(_.datetime_text), |
175 | | - time_test= Time(_.time_text), |
| 185 | + time_test = Time(_.time_text), |
| 186 | + format_test = format(_.datetime_text, "%Y-%m-%d %H:%M:%S"), |
176 | 187 | type_of_test = type_of(_.zero), |
177 | 188 | convert_test = convert(Int, _.b) |
178 | 189 | }) |> |
@@ -219,8 +230,10 @@ result = |
219 | 230 | @test result.SubString_test_1 == "b" |
220 | 231 | @test result.SubString_test_2 == "b" |
221 | 232 | @test result.random_test isa DataValue{Int} |
| 233 | +@test_broken length(result.randomstring_test) == 4 |
222 | 234 | @test result.date_test == "2019-12-08" |
223 | 235 | @test result.datetime_test == "2019-12-08 11:09:00" |
| 236 | +@test result.format_test == "2019-12-08 11:09:00" |
224 | 237 | @test result.time_test == "11:09:00" |
225 | 238 | @test result.type_of_test == "integer" |
226 | 239 |
|
|
0 commit comments