-
Notifications
You must be signed in to change notification settings - Fork 2
/
option_test.go
39 lines (31 loc) · 895 Bytes
/
option_test.go
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
35
36
37
38
39
package suricataparser
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestOptionString(t *testing.T) {
opt := NewOption("gid", "1")
assert.Equal(t, "gid:1;", opt.String())
}
func TestNewEmptyOption(t *testing.T) {
opt := NewEmptyOption("http_uri")
assert.Equal(t, "http_uri;", opt.String())
}
func TestNewMsgOption(t *testing.T) {
opt := NewMsgOption("ET MALWARE Win32/RecordBreaker CnC Checkin")
assert.Equal(t, OptMsg, opt.Name)
assert.Equal(t, "\"ET MALWARE Win32/RecordBreaker CnC Checkin\"", opt.Value)
}
func ExampleNewOption() {
fmt.Println(NewOption("rev", "1"))
// Output: rev:1;
}
func ExampleNewEmptyOption() {
fmt.Println(NewEmptyOption("http_uri"))
// Output: http_uri;
}
func ExampleNewMsgOption() {
fmt.Println(NewMsgOption("ET MALWARE Win32/RecordBreaker CnC Checkin"))
// Output: msg:"ET MALWARE Win32/RecordBreaker CnC Checkin";
}