forked from JanDeDobbeleer/oh-my-posh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock_test.go
29 lines (26 loc) · 884 Bytes
/
block_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
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBlockEnabled(t *testing.T) {
cases := []struct {
Case string
Expected bool
Segments []*Segment
Type BlockType
}{
{Case: "line break block", Expected: true, Type: LineBreak},
{Case: "prompt enabled", Expected: true, Type: Prompt, Segments: []*Segment{{active: true}}},
{Case: "prompt disabled", Expected: false, Type: Prompt, Segments: []*Segment{{active: false}}},
{Case: "prompt enabled multiple", Expected: true, Type: Prompt, Segments: []*Segment{{active: false}, {active: true}}},
{Case: "rprompt enabled multiple", Expected: true, Type: RPrompt, Segments: []*Segment{{active: false}, {active: true}}},
}
for _, tc := range cases {
block := &Block{
Type: tc.Type,
Segments: tc.Segments,
}
assert.Equal(t, tc.Expected, block.enabled(), tc.Case)
}
}