-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathactions_test.go
47 lines (40 loc) · 1.16 KB
/
actions_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
40
41
42
43
44
45
46
47
package main
import (
"bytes"
"github.com/stretchr/testify/assert"
"testing"
)
func TestWarning(t *testing.T) {
t.Run("all opts set", func(t *testing.T) {
buf := &bytes.Buffer{}
Warning(buf, "file", "line", "col", "msg")
assert.Equal(t, "::warning file=file,line=line,col=col::msg", buf.String())
})
t.Run("one opt set", func(t *testing.T) {
buf := &bytes.Buffer{}
Warning(buf, "file", "", "", "msg")
assert.Equal(t, "::warning file=file::msg", buf.String())
})
t.Run("no opts set", func(t *testing.T) {
buf := &bytes.Buffer{}
Warning(buf, "", "", "", "msg")
assert.Equal(t, "::warning ::msg", buf.String())
})
}
func TestError(t *testing.T) {
t.Run("all opts set", func(t *testing.T) {
buf := &bytes.Buffer{}
Error(buf, "file", "line", "col", "msg")
assert.Equal(t, "::error file=file,line=line,col=col::msg", buf.String())
})
t.Run("one opt set", func(t *testing.T) {
buf := &bytes.Buffer{}
Error(buf, "file", "", "", "msg")
assert.Equal(t, "::error file=file::msg", buf.String())
})
t.Run("no opts set", func(t *testing.T) {
buf := &bytes.Buffer{}
Error(buf, "", "", "", "msg")
assert.Equal(t, "::error ::msg", buf.String())
})
}