@@ -62,70 +62,59 @@ func inspectCompare(t *testing.T, htmlDoc *HTMLDoc, diffCount int, diffChanges [
62
62
// * c8e31bc (origin/add-csv) Add test csv file
63
63
// * 808038d (HEAD -> master, origin/master, origin/HEAD) Added test links
64
64
65
- // Inderect compare remove-files-b (head) with add-csv (base) branch
66
- //
67
- // 'link_hi' and 'test.csv' are deleted, 'test.txt' is added
68
65
func TestCompareBranches (t * testing.T ) {
69
66
defer tests .PrepareTestEnv (t )()
70
67
71
68
session := loginUser (t , "user2" )
69
+
70
+ // Inderect compare remove-files-b (head) with add-csv (base) branch
71
+ //
72
+ // 'link_hi' and 'test.csv' are deleted, 'test.txt' is added
72
73
req := NewRequest (t , "GET" , "/user2/repo20/compare/add-csv...remove-files-b" )
73
74
resp := session .MakeRequest (t , req , http .StatusOK )
74
75
htmlDoc := NewHTMLParser (t , resp .Body )
75
76
76
77
diffCount := 3
77
- diffChanges := [3 ]string {"link_hi" , "test.csv" , "test.txt" }
78
+ diffChanges := []string {"link_hi" , "test.csv" , "test.txt" }
78
79
79
- inspectCompare (t , htmlDoc , diffCount , diffChanges [:])
80
- }
80
+ inspectCompare (t , htmlDoc , diffCount , diffChanges )
81
81
82
- // Inderect compare remove-files-b (head) with remove-files-a (base) branch
83
- //
84
- // 'link_hi' and 'test.csv' are deleted, 'test.txt' is added
85
- func TestCompareDeleted (t * testing.T ) {
86
- defer tests .PrepareTestEnv (t )()
82
+ // Inderect compare remove-files-b (head) with remove-files-a (base) branch
83
+ //
84
+ // 'link_hi' and 'test.csv' are deleted, 'test.txt' is added
87
85
88
- session := loginUser (t , "user2" )
89
- req := NewRequest (t , "GET" , "/user2/repo20/compare/remove-files-a...remove-files-b" )
90
- resp := session .MakeRequest (t , req , http .StatusOK )
91
- htmlDoc := NewHTMLParser (t , resp .Body )
86
+ req = NewRequest (t , "GET" , "/user2/repo20/compare/remove-files-a...remove-files-b" )
87
+ resp = session .MakeRequest (t , req , http .StatusOK )
88
+ htmlDoc = NewHTMLParser (t , resp .Body )
92
89
93
- diffCount : = 3
94
- diffChanges : = [3 ]string {"link_hi" , "test.csv" , "test.txt" }
90
+ diffCount = 3
91
+ diffChanges = []string {"link_hi" , "test.csv" , "test.txt" }
95
92
96
- inspectCompare (t , htmlDoc , diffCount , diffChanges [:])
97
- }
93
+ inspectCompare (t , htmlDoc , diffCount , diffChanges )
98
94
99
- // Inderect compare remove-files-a (head) with remove-files-b (base) branch
100
- //
101
- // 'link_hi' and 'test.csv' are deleted
102
- func TestCompareDeletedReverse (t * testing.T ) {
103
- defer tests .PrepareTestEnv (t )()
95
+ // Inderect compare remove-files-a (head) with remove-files-b (base) branch
96
+ //
97
+ // 'link_hi' and 'test.csv' are deleted
104
98
105
- session := loginUser (t , "user2" )
106
- req := NewRequest (t , "GET" , "/user2/repo20/compare/remove-files-b...remove-files-a" )
107
- resp := session .MakeRequest (t , req , http .StatusOK )
108
- htmlDoc := NewHTMLParser (t , resp .Body )
99
+ req = NewRequest (t , "GET" , "/user2/repo20/compare/remove-files-b...remove-files-a" )
100
+ resp = session .MakeRequest (t , req , http .StatusOK )
101
+ htmlDoc = NewHTMLParser (t , resp .Body )
109
102
110
- diffCount : = 2
111
- diffChanges : = [2 ]string {"link_hi" , "test.csv" }
103
+ diffCount = 2
104
+ diffChanges = []string {"link_hi" , "test.csv" }
112
105
113
- inspectCompare (t , htmlDoc , diffCount , diffChanges [:])
114
- }
106
+ inspectCompare (t , htmlDoc , diffCount , diffChanges )
115
107
116
- // Direct compare remove-files-b (head) with remove-files-a (base) branch
117
- //
118
- // 'test.txt' is deleted
119
- func TestDirectCompareDeleted (t * testing.T ) {
120
- defer tests .PrepareTestEnv (t )()
108
+ // Direct compare remove-files-b (head) with remove-files-a (base) branch
109
+ //
110
+ // 'test.txt' is deleted
121
111
122
- session := loginUser (t , "user2" )
123
- req := NewRequest (t , "GET" , "/user2/repo20/compare/remove-files-b..remove-files-a" )
124
- resp := session .MakeRequest (t , req , http .StatusOK )
125
- htmlDoc := NewHTMLParser (t , resp .Body )
112
+ req = NewRequest (t , "GET" , "/user2/repo20/compare/remove-files-b..remove-files-a" )
113
+ resp = session .MakeRequest (t , req , http .StatusOK )
114
+ htmlDoc = NewHTMLParser (t , resp .Body )
126
115
127
- diffCount : = 1
128
- diffChanges : = [1 ]string {"test.txt" }
116
+ diffCount = 1
117
+ diffChanges = []string {"test.txt" }
129
118
130
- inspectCompare (t , htmlDoc , diffCount , diffChanges [:] )
119
+ inspectCompare (t , htmlDoc , diffCount , diffChanges )
131
120
}
0 commit comments