-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers_test.go
More file actions
61 lines (58 loc) · 1.23 KB
/
Copy pathhelpers_test.go
File metadata and controls
61 lines (58 loc) · 1.23 KB
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
package main
import "testing"
func TestUnescapeICalText(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{
name: "lowercase \\n escape sequence",
input: "Line 1\\nLine 2",
expected: "Line 1\nLine 2",
},
{
name: "uppercase \\N escape sequence",
input: "Line 1\\NLine 2",
expected: "Line 1\nLine 2",
},
{
name: "multiple escape sequences",
input: "Line 1\\nLine 2\\NLine 3",
expected: "Line 1\nLine 2\nLine 3",
},
{
name: "no escape sequences",
input: "Simple text",
expected: "Simple text",
},
{
name: "empty string",
input: "",
expected: "",
},
{
name: "escape sequence at start",
input: "\\nLine 1",
expected: "\nLine 1",
},
{
name: "escape sequence at end",
input: "Line 1\\n",
expected: "Line 1\n",
},
{
name: "mixed case escape sequences",
input: "Part 1\\nPart 2\\NPart 3",
expected: "Part 1\nPart 2\nPart 3",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := unescapeICalText(tt.input)
if result != tt.expected {
t.Errorf("unescapeICalText(%q) = %q, want %q", tt.input, result, tt.expected)
}
})
}
}