diff --git a/.github/workflows/chdb.yml b/.github/workflows/chdb.yml index 7087ad8..629dfd4 100644 --- a/.github/workflows/chdb.yml +++ b/.github/workflows/chdb.yml @@ -23,6 +23,8 @@ jobs: go mod tidy make build - name: Test + run: make test + - name: Test main run: LD_LIBRARY_PATH=./ ./chdb-go "SELECT 12345" build_mac: @@ -41,5 +43,7 @@ jobs: go mod tidy make build - name: Test + run: make test + - name: Test main run: ./chdb-go "SELECT 12345" diff --git a/chdbstable/chdb_test.go b/chdbstable/chdb_test.go index 62c237e..8b4a494 100644 --- a/chdbstable/chdb_test.go +++ b/chdbstable/chdb_test.go @@ -22,10 +22,10 @@ func TestQueryStableMultipleCases(t *testing.T) { expectOutput: "123\n", }, { - name: "Multiple Queries", + name: "Single Queries", argv: []string{"clickhouse", "--multiquery", "--output-format=CSV", "--query=SELECT 'abc';"}, expectError: false, - expectOutput: "abc", + expectOutput: "\"abc\"\n", }, } @@ -35,11 +35,11 @@ func TestQueryStableMultipleCases(t *testing.T) { result := QueryStable(len(tc.argv), tc.argv) // Assert based on the expected outcome of the test case - if (result == nil) != tc.expectError { + if (result == nil) && tc.expectError { t.Errorf("QueryStable() with args %v, expect error: %v, got result: %v", tc.argv, tc.expectError, result) } - if (result != nil) && (string(result) != tc.expectOutput) { + if (result != nil) && string(result.Buf()) != tc.expectOutput { t.Errorf("QueryStable() with args %v, expect output: %v, got output: %v", tc.argv, tc.expectOutput, string(result.Buf())) } })