From 4cbf90036dbaa6fa8d84562283af56882c79379a Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Sun, 24 Sep 2023 09:05:48 +0900 Subject: [PATCH] initial commits --- nullable_whennothing_test.go | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/nullable_whennothing_test.go b/nullable_whennothing_test.go index 7a65182..894e581 100644 --- a/nullable_whennothing_test.go +++ b/nullable_whennothing_test.go @@ -72,6 +72,72 @@ func TestNullable_WhenNothing(t *testing.T) { } } +func TestNullable_WhenNull_something(t *testing.T) { + + + tests := []struct{ + Nullable interface{WhenNothing(func())} + }{ + { + Nullable: nul.Null[string](), + }, + + + + { + Nullable: nul.Null[int](), + }, + { + Nullable: nul.Null[int8](), + }, + { + Nullable: nul.Null[int16](), + }, + { + Nullable: nul.Null[int32](), + }, + { + Nullable: nul.Null[int64](), + }, + + + + { + Nullable: nul.Null[uint](), + }, + { + Nullable: nul.Null[uint8](), + }, + { + Nullable: nul.Null[uint16](), + }, + { + Nullable: nul.Null[uint32](), + }, + { + Nullable: nul.Null[uint64](), + }, + } + + for testNumber, test := range tests { + + var worked bool = false + + test.Nullable.WhenNothing(func(){ + + worked = true + }) + + if worked { + t.Errorf("For test #%d, the call to the method worked, but it should not have.", testNumber) + t.Logf("WORKED: %t", worked) + t.Logf("NULLABLE: (%T) %#v", test.Nullable, test.Nullable) + //////////////// CONTINUE + continue + } + } +} + func TestNullable_WhenNothing_something(t *testing.T) {