-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathside_by_side_test.go
More file actions
69 lines (59 loc) · 1.42 KB
/
side_by_side_test.go
File metadata and controls
69 lines (59 loc) · 1.42 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
62
63
64
65
66
67
68
69
package diff2html
import (
"fmt"
"testing"
)
func TestNewSideBySide(t *testing.T) {
input := "--- a/sample.js\n" +
"+++ b/sample.js\n" +
"@@ -1 +1,2 @@\n" +
"-test\n" +
"+test1r\n" +
"+test2r\n"
d := newDiff(Config{
SrcPrefix: "",
DstPrefix: "",
})
d.Parser(input)
side := newSideBySide()
html, err := side.GenerateSideBySideHTML(d.Files)
fmt.Println(html)
fmt.Println(err)
}
func TestSideBySidePrinter_makeSideHTML(t *testing.T) {
side := newSideBySide()
html, err := side.makeSideHTML("header")
fmt.Println(html)
fmt.Println(err)
}
func TestSideBySidePrinter_genSingleLineHTML(t *testing.T) {
side := newSideBySide()
html, err := side.genSingleLineHTML(false, "d2h-cntx", 1, "{", " ")
fmt.Println(html)
fmt.Println(err)
}
func TestSideBySidePrinter_genEmptyDiff(t *testing.T) {
side := newSideBySide()
fileHTML, err := side.genEmptyDiff()
fmt.Println(fileHTML.Left)
fmt.Println(err)
}
func TestSideBySidePrinter_processLines(t *testing.T) {
oldLine := make([]*Line, 3)
newLine := make([]*Line, 5)
side := newSideBySide()
side.processLines(true, oldLine, newLine)
}
func Test_getDiffName(t *testing.T) {
file := &File{
OldName: "sample",
NewName: "sample2",
}
name := getDiffName(file)
fmt.Println(name)
}
func Test_diffHighlight(t *testing.T) {
highlight := diffHighlight(" category:campaign,", " category:guidance,", false)
fmt.Println(highlight.First.Line)
fmt.Println(highlight.Second.Line)
}