(t *testing.T)
| 51 | } |
| 52 | |
| 53 | func TestFormat(t *testing.T) { |
| 54 | template := "{{ .Seq }} {{.CPU}} - ({{.Type}}) -- pid: {{ .Params.Pid }} ({{.Params}}) {{ .Meta }}" |
| 55 | f, err := NewFormatter(template) |
| 56 | require.NoError(t, err) |
| 57 | params := Params{ |
| 58 | kpars.ProcessID: {Name: kpars.ProcessID, Type: kpars.PID, Value: uint32(876)}, |
| 59 | } |
| 60 | s := f.Format(&Event{CPU: uint8(4), Name: "CreateProcess", Seq: uint64(1999), Params: params, Metadata: map[MetadataKey]any{"key1": "value1"}}) |
| 61 | assert.Equal(t, "1999 4 - (CreateProcess) -- pid: 876 (pid➜ 876) key1: value1", string(s)) |
| 62 | } |
| 63 | |
| 64 | func TestFormatPS(t *testing.T) { |
| 65 | template := "{{ .Seq }} {{ .Process }} ({{ .Cwd }}) {{ .Ppid }} ({{ .Sid }})" |
nothing calls this directly
no test coverage detected