Add tests. They are quite basic ...
This commit is contained in:
30
config/config_test.go
Normal file
30
config/config_test.go
Normal 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user