initial commits

master
Charles Iliya Krempeaux 2023-09-24 09:05:48 +09:00
parent 14aedb7cb3
commit 4cbf90036d
1 changed files with 66 additions and 0 deletions

View File

@ -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) {