Bläddra i källkod

SVI Добавление тестов

SVI 6 månader sedan
förälder
incheckning
60add5bf0e
4 ändrade filer med 30 tillägg och 18 borttagningar
  1. 7 0
      v3/kern.go
  2. 5 0
      v3/kern_test.go
  3. 9 9
      v3/mds/mod_keeper/mod_keeper_test.go
  4. 9 9
      v3/mds/mod_serv_http/mod_serv_http_test.go

+ 7 - 0
v3/kern.go

@@ -18,6 +18,7 @@ import (
 	"gitp78su.ipnodns.ru/svi/kern/v3/krn/kbus/kbus_local"
 	"gitp78su.ipnodns.ru/svi/kern/v3/krn/kbus/kbus_local/client_bus_local"
 	"gitp78su.ipnodns.ru/svi/kern/v3/krn/kctx"
+	"gitp78su.ipnodns.ru/svi/kern/v3/krn/kint"
 	"gitp78su.ipnodns.ru/svi/kern/v3/krn/kmodule"
 	"gitp78su.ipnodns.ru/svi/kern/v3/krn/kmonolit"
 	"gitp78su.ipnodns.ru/svi/kern/v3/krn/kserv_http"
@@ -157,6 +158,12 @@ func NewSafeInt(val int) ISafeInt {
 	return val_
 }
 
+// NewInt -- возвращает новую целочисленную переменную
+func NewInt(val int) Int {
+	val_ := kint.NewInt(val)
+	return val_
+}
+
 // NewLocalCtx -- возвращает новый локальный контекст
 func NewLocalCtx(ctx context.Context) ILocalCtx {
 	ctx_ := local_ctx.NewLocalCtx(ctx)

+ 5 - 0
v3/kern_test.go

@@ -160,6 +160,11 @@ func (sf *tester) new() {
 	_ = MakeSome("test err")
 	_ = MakeNone[int64]()
 
+	valInt := NewInt(28)
+	if val := valInt.Get(); val != 28 {
+		sf.t.Fatalf("new(): cal(%v)!=28", val)
+	}
+
 	kernServHttp := GetKernelServerHttp()
 	go kernServHttp.Run()
 	ctx.Cancel()

+ 9 - 9
v3/mds/mod_keeper/mod_keeper_test.go

@@ -81,12 +81,12 @@ func (sf *tester) newGood1() {
 }
 
 // нет ничего для создания модуля
-func (sf *tester) newBad1() {
-	sf.t.Log("newBad1")
-	defer func() {
-		if _panic := recover(); _panic == nil {
-			sf.t.Fatalf("newBad1(): panic==nil")
-		}
-	}()
-	_ = GetModuleKeeper()
-}
+// func (sf *tester) newBad1() {
+// 	sf.t.Log("newBad1")
+// 	defer func() {
+// 		if _panic := recover(); _panic == nil {
+// 			sf.t.Fatalf("newBad1(): panic==nil")
+// 		}
+// 	}()
+// 	_ = GetModuleKeeper()
+// }

+ 9 - 9
v3/mds/mod_serv_http/mod_serv_http_test.go

@@ -80,12 +80,12 @@ func (sf *tester) newGood1() {
 }
 
 // нет ничего для создания модуля
-func (sf *tester) newBad1() {
-	sf.t.Log("newBad1")
-	defer func() {
-		if _panic := recover(); _panic == nil {
-			sf.t.Fatalf("newBad1(): panic==nil")
-		}
-	}()
-	_ = GetModuleServHttp()
-}
+// func (sf *tester) newBad1() {
+// 	sf.t.Log("newBad1")
+// 	defer func() {
+// 		if _panic := recover(); _panic == nil {
+// 			sf.t.Fatalf("newBad1(): panic==nil")
+// 		}
+// 	}()
+// 	_ = GetModuleServHttp()
+// }