File: columnformat_test.go

package info (click to toggle)
termshark 2.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,424 kB
  • sloc: sh: 98; makefile: 10
file content (34 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2019-2022 Graham Clark. All rights reserved.  Use of this source code is governed by the MIT license
// that can be found in the LICENSE file.

package shark

import (
	"fmt"
	"testing"

	"github.com/stretchr/testify/assert"
)

//======================================================================

func TestCF1(t *testing.T) {

	fields := &ColumnsFromTshark{}
	err := fields.InitNoCache()
	assert.NoError(t, err)

	cfmap := make(map[string]PsmlColumnSpec)
	for _, f := range fields.fields {
		fmt.Printf("GCLA: adding %v\n", f)
		cfmap[f.Field.Token] = f
	}

	m1, ok := cfmap["%At"]
	assert.Equal(t, true, ok)
	assert.Equal(t, "Absolute time", m1.Name)

	m2, ok := cfmap["%rs"]
	assert.Equal(t, true, ok)
	assert.Equal(t, "Src addr (resolved)", m2.Name)
}