[🤖] Add Unit-Tests
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m34s

This commit is contained in:
2026-04-27 10:46:08 +02:00
parent dad0e3240d
commit 02d6894ec6
116 changed files with 18795 additions and 1 deletions
+38
View File
@@ -0,0 +1,38 @@
package langext
import (
"errors"
"git.blackforestbytes.com/BlackForestBytes/goext/tst"
"testing"
)
func TestMustSuccess(t *testing.T) {
v := Must(42, nil)
tst.AssertEqual(t, v, 42)
s := Must("hello", nil)
tst.AssertEqual(t, s, "hello")
}
func TestMustPanics(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("expected panic on error")
}
}()
Must(0, errors.New("boom"))
}
func TestMustBoolSuccess(t *testing.T) {
v := MustBool(42, true)
tst.AssertEqual(t, v, 42)
}
func TestMustBoolPanics(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("expected panic on not ok")
}
}()
MustBool(0, false)
}