diff --git a/defaults/defaults_example_test.go b/defaults/defaults_example_test.go index ae5b184..06dbb90 100644 --- a/defaults/defaults_example_test.go +++ b/defaults/defaults_example_test.go @@ -21,7 +21,7 @@ func NewMyStruct(port int, host string, timeout time.Duration) *MyStruct { return &s } -func ExampleSetDefault() { +func ExampleSetFirst() { fmt.Println(NewMyStruct(0, "", 0)) fmt.Println(NewMyStruct(443, "example.com", 1*time.Minute)) // Output: @@ -37,7 +37,7 @@ func MakeMyStruct(port int, host string, timeout time.Duration) *MyStruct { } } -func ExampleFirst() { +func ExampleGetFirst() { fmt.Println(MakeMyStruct(0, "", 0)) fmt.Println(MakeMyStruct(443, "example.com", 1*time.Minute)) // Output: diff --git a/is/is.go b/is/is.go index 5555bb2..202e0a9 100644 --- a/is/is.go +++ b/is/is.go @@ -20,7 +20,7 @@ func Truthy[T comparable](v T) bool { // Note that the usual Go type system caveats apply around a nil pointer value not being a nil interface value. // // In benchmark testing, -// TruthyAny is approximately 25 times slower than Value, +// TruthyAny is approximately 25 times slower than Truthy, // and 50 times slower than native Go comparisons. func TruthyAny[T any](v T) bool { switch m := any(v).(type) { @@ -38,8 +38,8 @@ func TruthyMap[K comparable, V any, M ~map[K]V](v M) bool { return len(v) > 0 } -// Get returns the truthy value of dereferenced pointers of comparable types. -// Values are truthy if they are not equal to the zero value for the type. +// TruthyPointer returns the truthy value of dereferenced pointers of comparable types. +// Values are truthy if they are not equal to the zero value for the dereferenced type. // Note that it will evaluate to true for double pointers. func TruthyPointer[T comparable](v *T) bool { if v == nil { diff --git a/is/is_bench_test.go b/is/is_bench_test.go index c4dfdbe..c468af5 100644 --- a/is/is_bench_test.go +++ b/is/is_bench_test.go @@ -7,7 +7,7 @@ import ( "github.com/carlmjohnson/truthy/is" ) -func BenchmarkValueAny_error(b *testing.B) { +func BenchmarkTruthyAny_error(b *testing.B) { fillVal := errors.New("something") fill := false for i := 0; i < b.N; i++ { @@ -22,7 +22,7 @@ func BenchmarkValueAny_error(b *testing.B) { } } -func BenchmarkValue_error(b *testing.B) { +func BenchmarkTruthy_error(b *testing.B) { fillVal := errors.New("something") fill := false for i := 0; i < b.N; i++ { @@ -52,7 +52,7 @@ func Benchmark_error(b *testing.B) { } } -func BenchmarkValueAny_string(b *testing.B) { +func BenchmarkTruthyAny_string(b *testing.B) { fillVal := "something" fill := false for i := 0; i < b.N; i++ { @@ -67,7 +67,7 @@ func BenchmarkValueAny_string(b *testing.B) { } } -func BenchmarkValue_string(b *testing.B) { +func BenchmarkTruthy_string(b *testing.B) { fillVal := "something" fill := false for i := 0; i < b.N; i++ { @@ -97,7 +97,7 @@ func Benchmark_string(b *testing.B) { } } -func BenchmarkValueAny_int(b *testing.B) { +func BenchmarkTruthyAny_int(b *testing.B) { fillVal := 1 fill := false for i := 0; i < b.N; i++ { @@ -112,7 +112,7 @@ func BenchmarkValueAny_int(b *testing.B) { } } -func BenchmarkValue_int(b *testing.B) { +func BenchmarkTruthy_int(b *testing.B) { fillVal := 1 fill := false for i := 0; i < b.N; i++ { diff --git a/is/is_for_any_test.go b/is/is_for_any_test.go index 4f245ac..1f7d922 100644 --- a/is/is_for_any_test.go +++ b/is/is_for_any_test.go @@ -20,7 +20,7 @@ func test[T any](t *testing.T, v T, ok bool) { }) } -func TestValueForAny(t *testing.T) { +func TestTruthyAny(t *testing.T) { var err error test(t, err, false) err = (*errT)(nil) diff --git a/ternary/ternary_example_test.go b/ternary/ternary_example_test.go index 98d2f11..ee276e7 100644 --- a/ternary/ternary_example_test.go +++ b/ternary/ternary_example_test.go @@ -9,7 +9,7 @@ import ( func ExampleEvaluate_lazy() { i := 1 - // Cond cannot lazily evaluate its arguments, + // Evaluate cannot lazily evaluate its arguments, // but you can use a closure to fake it. s := ternary.Evaluate( is.Truthy(i),