old_console/correlator/rules/test_tools.go
2024-11-02 14:12:45 +03:00

17 lines
431 B
Go

package rules
import "testing"
// Help function for testing
// Check if map has needed key and this key has needed value
// Write message if some error occur
func testMap(m map[string]interface{}, name string, value interface{}, t *testing.T) {
v, ok := m[name]
if !ok {
t.Errorf("No key with name %v in map %v", name, m)
}
if v != value {
t.Errorf("Bad map value, expect %v (%T), got %v (%T)", value, value, v, v)
}
}