added more tests
Go Build and Test / build-and-test (push) Successful in 25s

This commit is contained in:
wt committed 2025-08-12 16:55:55 +07:00
1 parent bca550374f
commit f854cbace5
8 files changed
+343 -25

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
package main
import (
"testing"
)
func TestMainFunction(t *testing.T) {
// Сохраняем оригинальную функцию
originalExecute := execute
defer func() {
execute = originalExecute // Восстанавливаем после теста
}()
// Флаг для проверки вызова
called := false
execute = func() {
called = true // Подменяем функцию
}
// Запускаем main
main()
// Проверяем, что функция была вызвана
if !called {
t.Fatal("Expected cmd.Execute to be called, but it wasn't")
}
}