Skip to content

Commit d008751

Browse files
committed
Clean up ColEscapeNameTest ut
1 parent 93f7706 commit d008751

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

ut/client_ut.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -718,9 +718,9 @@ TEST_P(ClientCase, Decimal) {
718718

719719
// Test special chars in names
720720
TEST_P(ClientCase, ColEscapeNameTest) {
721-
client_->Execute("DROP TABLE IF EXISTS test_clickhouse_cpp.\"col_escape_name_test\";");
721+
client_->Execute("DROP TABLE IF EXISTS test_clickhouse_cpp.\"col_escape_\"\"name_test\";");
722722

723-
client_->Execute("CREATE TABLE IF NOT EXISTS test_clickhouse_cpp.\"col_escape_name_test\" (\"test space\" UInt64, \"test \"\" quote\" UInt64, \"test \"\"`'[]&_\\ all\" UInt64) ENGINE = Memory");
723+
client_->Execute("CREATE TABLE IF NOT EXISTS test_clickhouse_cpp.\"col_escape_\"\"name_test\" (\"test space\" UInt64, \"test \"\" quote\" UInt64, \"test \"\"`'[]&_\\ all\" UInt64) ENGINE = Memory");
724724

725725
auto col1 = std::make_shared<ColumnUInt64>();
726726
col1->Append(1);
@@ -732,26 +732,26 @@ TEST_P(ClientCase, ColEscapeNameTest) {
732732
col3->Append(16);
733733
col3->Append(32);
734734

735-
Block block;
736-
block.AppendColumn("test space", col1);
737-
block.AppendColumn("test \" quote", col2);
738-
block.AppendColumn("test \"`'[]&_\\ all", col3);
739-
740-
client_->Insert("test_clickhouse_cpp.col_escape_name_test", block);
741-
client_->Select("SELECT * FROM test_clickhouse_cpp.\"col_escape_name_test\"", [] ([[maybe_unused]]const Block& sblock)
742-
{
743-
int row = sblock.GetRowCount();
744-
if (row <= 0) {return;}
745-
int col = sblock.GetColumnCount();
746-
EXPECT_EQ(col, 3);
747-
EXPECT_EQ(row, 2);
748-
EXPECT_EQ(sblock[0]->As<ColumnUInt64>()->At(0), 1U);
749-
EXPECT_EQ(sblock[0]->As<ColumnUInt64>()->At(1), 2U);
750-
EXPECT_EQ(sblock[1]->As<ColumnUInt64>()->At(0), 4U);
751-
EXPECT_EQ(sblock[1]->As<ColumnUInt64>()->At(1), 8U);
752-
EXPECT_EQ(sblock[2]->As<ColumnUInt64>()->At(0), 16U);
753-
EXPECT_EQ(sblock[2]->As<ColumnUInt64>()->At(1), 32U);
754-
});
735+
Block block;
736+
block.AppendColumn("test space", col1);
737+
block.AppendColumn("test \" quote", col2);
738+
block.AppendColumn("test \"`'[]&_\\ all", col3);
739+
740+
client_->Insert("test_clickhouse_cpp.\"col_escape_\"\"name_test\"", block);
741+
client_->Select("SELECT * FROM test_clickhouse_cpp.\"col_escape_\"\"name_test\"", [] (const Block& sblock)
742+
{
743+
int row = sblock.GetRowCount();
744+
if (row <= 0) {return;}
745+
int col = sblock.GetColumnCount();
746+
EXPECT_EQ(col, 3);
747+
EXPECT_EQ(row, 2);
748+
EXPECT_EQ(sblock[0]->As<ColumnUInt64>()->At(0), 1u);
749+
EXPECT_EQ(sblock[0]->As<ColumnUInt64>()->At(1), 2u);
750+
EXPECT_EQ(sblock[1]->As<ColumnUInt64>()->At(0), 4u);
751+
EXPECT_EQ(sblock[1]->As<ColumnUInt64>()->At(1), 8u);
752+
EXPECT_EQ(sblock[2]->As<ColumnUInt64>()->At(0), 16u);
753+
EXPECT_EQ(sblock[2]->As<ColumnUInt64>()->At(1), 32u);
754+
});
755755
}
756756

757757
// Test roundtrip of DateTime64 values

0 commit comments

Comments
 (0)