Skip to content

test(contrib/drivers/mysql): enhance complex query tests#4707

Merged
gqcn merged 1 commit into
gogf:masterfrom
lingcoder:test/mysql-complex-query-enhancement
Feb 27, 2026
Merged

test(contrib/drivers/mysql): enhance complex query tests#4707
gqcn merged 1 commit into
gogf:masterfrom
lingcoder:test/mysql-complex-query-enhancement

Conversation

@lingcoder
Copy link
Copy Markdown
Contributor

Summary

  • Add comprehensive JOIN tests (Inner/Left/Right Join)
  • Add SubQuery tests
  • Add complex WHERE condition tests (Or/Group/Having)
  • Add advanced query builder tests

Test coverage added: ~26 test functions across 3 files

Ref #4689

Test plan

cd contrib/drivers/mysql
go test -v -run "TestModel_Join|TestModel_SubQuery|TestModel_Where.*Complex"

@lingcoder lingcoder force-pushed the test/mysql-complex-query-enhancement branch 3 times, most recently from da9e4c9 to 6096cf5 Compare February 13, 2026 13:37
@gqcn gqcn requested a review from Copilot February 26, 2026 01:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the MySQL driver's test coverage by adding comprehensive tests for complex query scenarios including JOINs, subqueries, and advanced WHERE conditions. The work aligns with issue #4689's goal to strengthen MySQL test coverage before porting tests to other database drivers.

Changes:

  • Added 15 new test functions for WherePrefix* methods with various operators (IN, BETWEEN, comparison operators, LIKE, NULL checks)
  • Added 6 new subquery test functions covering correlated queries, FROM/SELECT clause subqueries, nested queries, and complex combinations
  • Added 6 new JOIN test functions for multi-table joins (5+ tables), self-joins, NULL handling in LEFT/RIGHT joins, ON vs WHERE semantics, and complex join conditions

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
mysql_z_unit_model_where_test.go Adds 15 test functions for WherePrefix*/WhereOrPrefix* methods and HAVING clause with aggregate functions
mysql_z_unit_feature_model_subquery_test.go Adds fmt import and 6 test functions for subquery scenarios (correlated, FROM/SELECT clause, nested, complex)
mysql_z_unit_feature_model_join_test.go Adds 6 test functions for advanced JOIN scenarios (5+ tables, self-join, NULL handling, ON vs WHERE)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contrib/drivers/mysql/mysql_z_unit_model_where_test.go Outdated
Comment thread contrib/drivers/mysql/mysql_z_unit_feature_model_subquery_test.go
@gqcn gqcn changed the title test(mysql): enhance complex query tests test(contrib/drivers/mysql): enhance complex query tests Feb 26, 2026
Add comprehensive tests for JOIN, SubQuery, and complex WHERE conditions.

## New Test Coverage

### Join Tests (mysql_z_unit_feature_model_join_test.go)
- Inner/Left/Right Join operations
- Multiple table joins with complex conditions
- Join with aggregate functions and grouping

### SubQuery Tests (mysql_z_unit_feature_model_subquery_test.go)
- Subquery in WHERE clause (IN, NOT IN, ANY, ALL)
- Subquery in FROM clause
- Subquery in SELECT clause
- Correlated subqueries
- Nested subqueries (3+ levels)

### Complex WHERE Tests (mysql_z_unit_model_where_test.go)
- WherePrefix with various operators (LT, LTE, GT, GTE, Between, NotBetween)
- WhereOr/WhereAnd combinations
- Complex nested condition groups

## Total Added
~26 test functions across 3 files, 1040+ lines

Ref gogf#4689
@lingcoder lingcoder force-pushed the test/mysql-complex-query-enhancement branch from 6096cf5 to af13080 Compare February 26, 2026 15:00
@gqcn gqcn merged commit 307c6ec into gogf:master Feb 27, 2026
18 checks passed
@lingcoder lingcoder deleted the test/mysql-complex-query-enhancement branch February 28, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants