mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
f537a98fcd
* Update staticcheck to latest * Add static checks while ignoring for third party / external stuff * Added a hack to keep go mod happy. * disable SA2002 * Pin go mod tidy checker image to golang:1.20-alpine
30 lines
935 B
Go
30 lines
935 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestAddExclusion(t *testing.T) {
|
|
cfg := Configs{
|
|
"foo": Config{},
|
|
}
|
|
|
|
cfg.AddExclusion("sa0000", []string{"foo.go", "bar.go"})
|
|
|
|
if len(cfg["sa0000"].ExcludeFiles) != 2 {
|
|
t.Errorf("Expected 2 exclusions, got %d", len(cfg["sa0000"].ExcludeFiles))
|
|
}
|
|
if cfg["sa0000"].ExcludeFiles["foo.go"] != exclusionMessage {
|
|
t.Errorf("Expected exclusion message, got %s", cfg["sa0000"].ExcludeFiles["foo.go"])
|
|
}
|
|
if cfg["sa0000"].ExcludeFiles["bar.go"] != exclusionMessage {
|
|
t.Errorf("Expected exclusion message, got %s", cfg["sa0000"].ExcludeFiles["bar.go"])
|
|
}
|
|
|
|
cfg.AddExclusion("sa0000", []string{"foo.go", "baz.go"})
|
|
if len(cfg["sa0000"].ExcludeFiles) != 3 {
|
|
t.Errorf("Expected 3 exclusions, got %d", len(cfg["sa0000"].ExcludeFiles))
|
|
}
|
|
if cfg["sa0000"].ExcludeFiles["baz.go"] != exclusionMessage {
|
|
t.Errorf("Expected exclusion message, got %s", cfg["sa0000"].ExcludeFiles["baz.go"])
|
|
}
|
|
}
|