forked from mrombout/gdgettext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender_test.go
More file actions
44 lines (38 loc) · 762 Bytes
/
render_test.go
File metadata and controls
44 lines (38 loc) · 762 Bytes
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
package main
import (
"bytes"
"io/ioutil"
"testing"
)
func TestRender(t *testing.T) {
expectedOutput, err := ioutil.ReadFile("test/test_render.po")
if err != nil {
t.Fatal(err)
}
poFile := poFile{
Translations: map[msgID]message{
"test": {
Files: []messageLocation{
{
File: "my_script.gd",
Line: 1,
},
{
File: "my_script.tscn",
Line: 76,
},
},
Msgid: "test",
Msgstr: "It's a string!",
},
},
}
buf := bytes.Buffer{}
err = render(poFile, &buf)
if err != nil {
t.Fatal(err)
}
if !bytes.Equal(buf.Bytes(), expectedOutput) {
t.Fatalf("output does not match expected output\n\n ACTUAL OUTPUT ====\n%v\nEXPECTED OUTPUT ====\n%v", buf.String(), string(expectedOutput))
}
}