Add tests. They are quite basic ...

This commit is contained in:
Pim van Pelt
2025-06-11 00:02:04 +02:00
parent cb8acc4c13
commit 0a0e3e7055
6 changed files with 518 additions and 0 deletions

30
config/config_test.go Normal file
View File

@ -0,0 +1,30 @@
// Copyright 2025, IPng Networks GmbH, Pim van Pelt <pim@ipng.ch>
package config
import "testing"
func TestDebugFlagDefault(t *testing.T) {
// Test that Debug flag starts as false by default
if Debug != false {
t.Errorf("Expected Debug to be false by default, got %v", Debug)
}
}
func TestDebugFlagSet(t *testing.T) {
// Save original value
original := Debug
defer func() { Debug = original }()
// Test setting Debug to true
Debug = true
if Debug != true {
t.Errorf("Expected Debug to be true after setting, got %v", Debug)
}
// Test setting Debug to false
Debug = false
if Debug != false {
t.Errorf("Expected Debug to be false after setting, got %v", Debug)
}
}