@@ -32,7 +32,7 @@ func TestSearchRepo(t *testing.T) {
32
32
repo , err := repo_model .GetRepositoryByOwnerAndName (db .DefaultContext , "user2" , "repo1" )
33
33
assert .NoError (t , err )
34
34
35
- executeIndexer ( t , repo , code_indexer .UpdateRepoIndexer )
35
+ code_indexer .UpdateRepoIndexer ( repo )
36
36
37
37
testSearch (t , "/user2/repo1/search?q=Description&page=1" , []string {"README.md" })
38
38
@@ -42,12 +42,14 @@ func TestSearchRepo(t *testing.T) {
42
42
repo , err = repo_model .GetRepositoryByOwnerAndName (db .DefaultContext , "user2" , "glob" )
43
43
assert .NoError (t , err )
44
44
45
- executeIndexer ( t , repo , code_indexer .UpdateRepoIndexer )
45
+ code_indexer .UpdateRepoIndexer ( repo )
46
46
47
47
testSearch (t , "/user2/glob/search?q=loren&page=1" , []string {"a.txt" })
48
- testSearch (t , "/user2/glob/search?q=file3&page=1" , []string {"x/b.txt" })
49
- testSearch (t , "/user2/glob/search?q=file4&page=1" , []string {})
50
- testSearch (t , "/user2/glob/search?q=file5&page=1" , []string {})
48
+ testSearch (t , "/user2/glob/search?q=loren&page=1&t=match" , []string {"a.txt" })
49
+ testSearch (t , "/user2/glob/search?q=file3&page=1" , []string {"x/b.txt" , "a.txt" })
50
+ testSearch (t , "/user2/glob/search?q=file3&page=1&t=match" , []string {"x/b.txt" , "a.txt" })
51
+ testSearch (t , "/user2/glob/search?q=file4&page=1&t=match" , []string {"x/b.txt" , "a.txt" })
52
+ testSearch (t , "/user2/glob/search?q=file5&page=1&t=match" , []string {"x/b.txt" , "a.txt" })
51
53
}
52
54
53
55
func testSearch (t * testing.T , url string , expected []string ) {
@@ -57,7 +59,3 @@ func testSearch(t *testing.T, url string, expected []string) {
57
59
filenames := resultFilenames (t , NewHTMLParser (t , resp .Body ))
58
60
assert .EqualValues (t , expected , filenames )
59
61
}
60
-
61
- func executeIndexer (t * testing.T , repo * repo_model.Repository , op func (* repo_model.Repository )) {
62
- op (repo )
63
- }
0 commit comments