add bracket syntax replace tests
This commit is contained in:
46
lang/test_comparison_utils.go
Normal file
46
lang/test_comparison_utils.go
Normal file
@ -0,0 +1,46 @@
|
||||
package lang
|
||||
|
||||
// Basic comparison utilities for parser tests
|
||||
|
||||
// Helper functions for creating pointers
|
||||
func stringPtr(s string) *string {
|
||||
return &s
|
||||
}
|
||||
|
||||
func intPtr(i int) *int {
|
||||
return &i
|
||||
}
|
||||
|
||||
// Pointer comparison functions
|
||||
func stringPtrEqual(got, want *string) bool {
|
||||
if (got == nil) != (want == nil) {
|
||||
return false
|
||||
}
|
||||
if got != nil && want != nil {
|
||||
return *got == *want
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func intPtrEqual(got, want *int) bool {
|
||||
if (got == nil) != (want == nil) {
|
||||
return false
|
||||
}
|
||||
if got != nil && want != nil {
|
||||
return *got == *want
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Slice comparison functions
|
||||
func stringSliceEqual(got, want []string) bool {
|
||||
if len(got) != len(want) {
|
||||
return false
|
||||
}
|
||||
for i, s := range got {
|
||||
if s != want[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
Reference in New Issue
Block a user