mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
36 lines
684 B
Go
36 lines
684 B
Go
package widgets
|
|
|
|
import "testing"
|
|
|
|
func TestSplitEmptyLine(t *testing.T) {
|
|
|
|
result := splitLine("", 5)
|
|
if len(result) != 0 {
|
|
t.Errorf("expected: 0 lines, got: %d", len(result))
|
|
}
|
|
}
|
|
|
|
func TestSplitLineShorterThanLimit(t *testing.T) {
|
|
|
|
result := splitLine("hello", 7)
|
|
if len(result) != 1 {
|
|
t.Errorf("expected: 0 lines, got: %d", len(result))
|
|
}
|
|
}
|
|
|
|
func TestSplitLineLongerThanLimit(t *testing.T) {
|
|
|
|
result := splitLine("hello", 3)
|
|
if len(result) != 2 {
|
|
t.Errorf("expected: 0 lines, got: %d", len(result))
|
|
}
|
|
}
|
|
|
|
func TestSplitLineSameAsLimit(t *testing.T) {
|
|
|
|
result := splitLine("hello", 5)
|
|
if len(result) != 1 {
|
|
t.Errorf("expected: 0 lines, got: %d", len(result))
|
|
}
|
|
}
|