From 8e603ba330e2ba2386178d2e13e4d3b659fc96ab Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Sun, 14 Jul 2024 17:01:59 +0700 Subject: [PATCH] eh --- .../clickhouse_binary_type_test.exs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/ecto/integration/clickhouse_binary_type_test.exs diff --git a/test/ecto/integration/clickhouse_binary_type_test.exs b/test/ecto/integration/clickhouse_binary_type_test.exs new file mode 100644 index 0000000..bcb8593 --- /dev/null +++ b/test/ecto/integration/clickhouse_binary_type_test.exs @@ -0,0 +1,26 @@ +defmodule Ecto.Integration.BinaryTypeTest do + use Ecto.Integration.Case, async: true + import Ecto.Query + alias Ecto.Integration.TestRepo + + test "it works" do + TestRepo.query!("CREATE TABLE binary_test(bin String) ENGINE = Memory") + on_exit(fn -> TestRepo.query!("DROP TABLE binary_test") end) + + bin = "\x61\xF0\x80\x80\x80b" + TestRepo.query!(["INSERT INTO binary_test(bin) FORMAT RowBinary\n", byte_size(bin) | bin]) + + assert TestRepo.one( + from t in "binary_test", + select: %{ + default: t.bin, + type_binary: type(t.bin, :binary), + length: fragment("length(?)", t.bin) + } + ) == %{ + default: _utf8_escaped = "a�b", + type_binary: bin, + length: _original_length = length(6) + } + end +end