-
Notifications
You must be signed in to change notification settings - Fork 4
/
trimming_test.go
79 lines (68 loc) · 2.02 KB
/
trimming_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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package textwrap
import (
"gotest.tools/assert"
"testing"
)
/*
Test TrimLeft on trimming leading whitespace from the string
*/
func TestTrimLeft(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimLeft(" trim me"), "trim me")
}
/*
Test TrimLeft on trimming leading whitespace from the string, containing trailing spaces
*/
func TestTrimLeftWithTrail(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimLeft(" trim me "), "trim me ")
}
/*
Test TrimLeft on trimming mixed leading whitespace from the string
*/
func TestTrimLeftLeadingTabs(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimLeft(" \t\t\ttrim me"), "trim me")
}
/*
Test TrimLeft on trimming leading newline.
*/
func TestTrimLeftNewline(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimLeft("\nline\n"), "line\n")
}
/*
Test TrimLeft on trimming leading whitespace from the string,
containing trailing mixed whitespace.
*/
func TestTrimeLeftTrailingTabs(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimLeft(" \t\t\ttrim me\t \t"), "trim me\t \t")
}
/*
Test TrimLeft on trimming trailing whitespace from the string.
*/
func TestTrimRight(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimRight("trim me "), "trim me")
}
/*
Test TrimLeft on trimming trailing whitespace from the string,
containing leading whitespace.
*/
func TestTrimRightWithLead(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimRight(" trim me "), " trim me")
}
/*
Test TrimLeft on trimming trailing mixed whitespace from the string.
*/
func TestTrimRightTrailingTabs(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimRight("trim me\t \t \n\t "), "trim me")
}
/*
Test TrimLeft on trimming trailing mixed whitespace from the string,
containing leading mixed whitespace
*/
func TestTrimRightLeadingTabs(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimRight(" \t\t\ttrim me\t \t\n"), " \t\t\ttrim me")
}
/*
Test TrimLeft on trimming trailing newline.
*/
func TestTrimRightNewline(t *testing.T) {
assert.Equal(t, NewTextWrap().TrimRight("\nline\n"), "\nline")
}