File: atoms_test.go

package info (click to toggle)
golang-github-pterm-pterm 0.12.79-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,640 kB
  • sloc: makefile: 4
file content (44 lines) | stat: -rw-r--r-- 864 bytes parent folder | download
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
package pterm_test

import (
	"testing"

	"github.com/MarvinJWendt/testza"
	"github.com/pterm/pterm"
)

func TestBar_WithLabel(t *testing.T) {
	p := pterm.Bar{}
	s := "X"
	p2 := p.WithLabel(s)

	testza.AssertEqual(t, s, p2.Label)
	testza.AssertZero(t, p.Label)
}

func TestBar_WithStyle(t *testing.T) {
	p := pterm.Bar{}
	s := pterm.NewStyle(pterm.FgRed, pterm.BgBlue, pterm.Bold)
	p2 := p.WithStyle(s)

	testza.AssertEqual(t, s, p2.Style)
	testza.AssertZero(t, p.Style)
}

func TestBar_WithValue(t *testing.T) {
	p := pterm.Bar{}
	s := 1337
	p2 := p.WithValue(s)

	testza.AssertEqual(t, s, p2.Value)
	testza.AssertZero(t, p.Value)
}

func TestBar_WithLabelStyle(t *testing.T) {
	p := pterm.Bar{}
	s := pterm.NewStyle(pterm.FgRed, pterm.BgBlue, pterm.Bold)
	p2 := p.WithLabelStyle(s)

	testza.AssertEqual(t, s, p2.LabelStyle)
	testza.AssertZero(t, p.LabelStyle)
}