-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathutil_test.go
68 lines (61 loc) · 1.89 KB
/
util_test.go
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
66
67
68
// Copyright 2013 ChaiShushan <chaishushan{AT}gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package mo
import (
"testing"
)
func TestDecodePoString(t *testing.T) {
if s := decodePoString(poStrEncode); s != poStrDecode {
t.Fatalf(`expect = %s got = %s`, poStrDecode, s)
}
}
func TestEncodePoString(t *testing.T) {
if s := encodePoString(poStrDecode); s != poStrEncodeStd {
t.Fatalf(`expect = %s; got = %s`, poStrEncodeStd, s)
}
}
const poStrEncode = `# noise
123456789
"Project-Id-Version: Poedit 1.5\n"
"Report-Msgid-Bugs-To: poedit@googlegroups.com\n"
"POT-Creation-Date: 2012-07-30 10:34+0200\n"
"PO-Revision-Date: 2013-02-24 21:00+0800\n"
"Last-Translator: Christopher Meng <trans@cicku.me>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 1.5.5\n"
"TestPoString: abc"
"123\n"
>>
123456???
`
const poStrEncodeStd = `"Project-Id-Version: Poedit 1.5\n"
"Report-Msgid-Bugs-To: poedit@googlegroups.com\n"
"POT-Creation-Date: 2012-07-30 10:34+0200\n"
"PO-Revision-Date: 2013-02-24 21:00+0800\n"
"Last-Translator: Christopher Meng <trans@cicku.me>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 1.5.5\n"
"TestPoString: abc123\n"
`
const poStrDecode = `Project-Id-Version: Poedit 1.5
Report-Msgid-Bugs-To: poedit@googlegroups.com
POT-Creation-Date: 2012-07-30 10:34+0200
PO-Revision-Date: 2013-02-24 21:00+0800
Last-Translator: Christopher Meng <trans@cicku.me>
Language-Team:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Plural-Forms: nplurals=1; plural=0;
X-Generator: Poedit 1.5.5
TestPoString: abc123
`