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
|
#!/bin/sh
set -euo pipefail
exit
// FIXME
// func (s *xgettextTestSuite) TestIntegration(c *C) {
// fname := makeGoSourceFile(c, []byte(`package main
//
// func main() {
// // TRANSLATORS: foo comment
// // with multiple lines
// i18n.G("foo")
//
// // this comment has no translators tag
// i18n.G("abc")
//
// // TRANSLATORS: plural
// i18n.NG("singular", "plural", 99)
//
// i18n.G("zz %s")
// }
// `))
//
// // a real integration test :)
// outName := filepath.Join(c.MkDir(), "snappy.pot")
// os.Args = []string{"test-binary",
// "--output", outName,
// "--keyword", "i18n.G",
// "--keyword-plural", "i18n.NG",
// "--msgid-bugs-address", "snappy-devel@lists.ubuntu.com",
// "--package-name", "snappy",
// fname,
// }
// main()
//
// // verify its what we expect
// got, err := ioutil.ReadFile(outName)
// c.Assert(err, IsNil)
// expected := fmt.Sprintf(`%s
// #: %[2]s:9
// msgid "abc"
// msgstr ""
//
// #. TRANSLATORS: foo comment
// #. with multiple lines
// #: %[2]s:6
// msgid "foo"
// msgstr ""
//
// #. TRANSLATORS: plural
// #: %[2]s:12
// msgid "singular"
// msgid_plural "plural"
// msgstr[0] ""
// msgstr[1] ""
//
// #: %[2]s:14
// #, c-format
// msgid "zz %%s"
// msgstr ""
//
// `, header, fname)
// c.Assert(string(got), Equals, expected)
// }
|