Remove testify/require dependency and use standard testing#5
Merged
kyleconroy merged 1 commit intomainfrom Apr 26, 2026
Merged
Conversation
Replace github.com/stretchr/testify/require calls with the equivalent stdlib testing patterns (if-cond t.Fatal/t.Fatalf). Use reflect.DeepEqual for value comparisons that aren't directly comparable with ==. https://claude.ai/code/session_01SzZiuen17CDNi8REpAGw1k
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the
github.com/stretchr/testify/requiredependency from the codebase and replaces all assertion calls with standard Go testing patterns usingreflect.DeepEqual()for equality checks and manualt.Fatal()calls for assertions.Summary
The testify/require library has been completely removed as a dependency. All test files that previously used
require.Equal(),require.True(),require.False(),require.NoError(), etc. have been refactored to use idiomatic Go testing with the standardtestingpackage.Key Changes
github.com/stretchr/testify v1.8.4fromgo.modrequire.Equal(t, expected, actual)calls withreflect.DeepEqual()checks followed byt.Fatalf()on mismatchrequire.True(t, condition)withif !condition { t.Fatal("expected true") }require.False(t, condition)withif condition { t.Fatal("expected false") }require.NoError(t, err)withif err != nil { t.Fatal(err) }require.NotEmpty(t, value)withif len(value) == 0 { t.Fatal("expected non-empty") }"reflect"imports to test files where neededFiles Modified
Test files across multiple packages were updated:
types/field_type_test.goparser/lexer_test.go,parser/digester_test.go,parser/lateral_test.go,parser/reserved_words_test.go,parser/consistent_test.go,parser/hintparser_test.go,parser/keywords_test.goast/util_test.go,ast/stats_test.go,ast/base_test.go,ast/dml_test.go,ast/model_test.go,ast/misc_test.go,ast/functions_test.go,ast/procedure_test.go,ast/flag_test.go,ast/format_test.go,ast/ddl_test.go,ast/expressions_test.go,ast/sem_test.gomysql/privs_test.go,mysql/const_test.go,mysql/type_test.go,mysql/error_test.gocharset/charset_test.go,charset/encoding_test.goauth/tidb_sm3_test.go,auth/caching_sha2_test.go,auth/mysql_native_password_test.goterror/terror_test.goformat/format_test.goduration/duration_test.goutil/escape_test.gogenerate_keyword/genkeyword_test.goImplementation Details
The refactoring maintains the same test logic and assertions while using only the Go standard library. Error messages follow a consistent pattern:
"got %v, want %v"for equality assertions and descriptive messages for boolean checks.https://claude.ai/code/session_01SzZiuen17CDNi8REpAGw1k