Skip to content
Snippets Groups Projects
Commit 79e50fee authored by Nick Thomas's avatar Nick Thomas
Browse files

Add integration tests for charset conversions

parent 25e9cafe
No related branches found
No related tags found
1 merge request!1Initial implementation of an elasticsearch indexer in Go
Pipeline #
Loading
Loading
@@ -94,6 +94,32 @@ func TestIndexingRemovesFiles(t *testing.T) {
assert.Error(t, err)
}
 
// Go source is defined to be UTF-8 encoded, so literals here are UTF-8
func TestIndexingTranscodesToUTF8(t *testing.T) {
checkDeps(t)
c, td := buildIndex(t)
defer td()
assert.NoError(t, run("", headSHA))
for _, tc := range []struct{
path string
expected string
} {
{"encoding/iso8859.txt", "狞\n"}, // GB18030
{"encoding/test.txt", "これはテストです。\nこれもマージして下さい。\n\nAdd excel file.\nDelete excel file."}, // SHIFT_JIS
} {
blob, err := c.GetBlob(tc.path)
assert.NoError(t, err)
blobDoc := make(map[string]*indexer.Blob)
assert.NoError(t, json.Unmarshal(*blob.Source, &blobDoc))
assert.Equal(t, tc.expected, blobDoc["blob"].Content)
}
}
func TestIndexingGitlabTest(t *testing.T) {
checkDeps(t)
c, td := buildIndex(t)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment