-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenders_test.go
More file actions
34 lines (25 loc) · 828 Bytes
/
renders_test.go
File metadata and controls
34 lines (25 loc) · 828 Bytes
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
package gosl
import (
"testing"
"github.com/charmbracelet/lipgloss"
"github.com/stretchr/testify/assert"
)
var resultRenders string
func BenchmarkRenderStyled(b *testing.B) {
var r string
for i := 0; i < b.N; i++ {
r = RenderStyled("Hello, World!", lipgloss.NewStyle().Foreground(lipgloss.Color("42")))
}
resultRenders = r
}
func TestRenderStyled(t *testing.T) {
r := RenderStyled("", lipgloss.Style{})
assert.EqualValues(t, "", r)
r = RenderStyled("Hello, World!", lipgloss.NewStyle().Foreground(lipgloss.Color("42")))
assert.EqualValues(t, "Hello, World!", r)
g := Utility{} // tests for method
r = g.RenderStyled("", lipgloss.Style{})
assert.EqualValues(t, "", r)
r = g.RenderStyled("Hello, World!", lipgloss.NewStyle().Foreground(lipgloss.Color("42")))
assert.EqualValues(t, "Hello, World!", r)
}