5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__
= "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Make sure, that the examples given in user guide all work.
33 test
= TestSCons
.TestSCons()
35 if not test
.where_is('msginit'):
36 test
.skip_test("Could not find 'msginit'; skipping test(s)\n")
39 # SOME DESCRIPTIVE TITLE.
40 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
41 # This file is distributed under the same license as the PACKAGE package.
42 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
47 "Project-Id-Version: PACKAGE VERSION\\n"
48 "Report-Msgid-Bugs-To: \\n"
49 "POT-Creation-Date: 2012-05-27 00:35+0200\\n"
50 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
51 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
52 "Language-Team: LANGUAGE <LL@li.org>\\n"
54 "MIME-Version: 1.0\\n"
55 "Content-Type: text/plain; charset=CHARSET\\n"
56 "Content-Transfer-Encoding: 8bit\\n"
59 msgid "Hello from a.cpp"
63 ###############################################################################
65 ###############################################################################
67 test
.write( ['ex1', 'SConstruct'],
69 env = Environment( tools = ["default", "msginit"] )
71 env.POInit(['en','pl']) # messages.pot --> [en.po, pl.po]
74 test
.write(['ex1', 'messages.pot'], pot_contents
)
76 # NOTE: msginit(1) prints all its messages to stderr, we must ignore them,
77 # So, stderr=None is crucial here. It is no point to match stderr to some
78 # specific valuse; the messages are internationalized :) ).
79 test
.run(arguments
= 'po-create', chdir
= 'ex1', stderr
= None)
80 test
.must_exist( ['ex1', 'en.po'] )
81 test
.must_exist( ['ex1', 'pl.po'] )
82 test
.must_contain( ['ex1', 'en.po'], "Hello from a.cpp", mode
='r')
83 test
.must_contain( ['ex1', 'pl.po'], "Hello from a.cpp", mode
='r')
86 ###############################################################################
88 ###############################################################################
90 test
.write( ['ex2', 'SConstruct'],
92 env = Environment( tools = ["default", "msginit"] )
94 env.POInit(['en','pl'], ['foo']) # foo.pot --> [en.po, pl.po]
97 test
.write(['ex2', 'foo.pot'], pot_contents
)
99 # NOTE: msginit(1) prints all its messages to stderr, we must ignore them,
100 # So, stderr=None is crucial here. It is no point to match stderr to some
101 # specific valuse; the messages are internationalized :) ).
102 test
.run(arguments
= 'po-create', chdir
= 'ex2', stderr
= None)
103 test
.must_exist( ['ex2', 'en.po'] )
104 test
.must_exist( ['ex2', 'pl.po'] )
105 test
.must_contain( ['ex2', 'en.po'], "Hello from a.cpp", mode
='r' )
106 test
.must_contain( ['ex2', 'pl.po'], "Hello from a.cpp", mode
='r' )
108 ###############################################################################
110 ###############################################################################
112 test
.write( ['ex3', 'SConstruct'],
114 env = Environment( tools = ["default", "msginit"] )
115 env['POAUTOINIT'] = 1
116 env.POInit(['en','pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po]
119 test
.write(['ex3', 'foo.pot'], pot_contents
)
121 # NOTE: msginit(1) prints all its messages to stderr, we must ignore them,
122 # So, stderr=None is crucial here. It is no point to match stderr to some
123 # specific valuse; the messages are internationalized :) ).
124 test
.run(arguments
= 'po-create', chdir
= 'ex3', stderr
= None)
125 test
.must_exist( ['ex3', 'en.po'] )
126 test
.must_exist( ['ex3', 'pl.po'] )
127 test
.must_contain( ['ex3', 'en.po'], "Hello from a.cpp", mode
='r')
128 test
.must_contain( ['ex3', 'pl.po'], "Hello from a.cpp", mode
='r')
130 ###############################################################################
132 ###############################################################################
134 test
.write( ['ex4', 'SConstruct'],
136 env = Environment( tools = ["default", "msginit"] )
137 env['POAUTOINIT'] = 1
138 env.POInit(LINGUAS_FILE = 1) # needs 'LINGUAS' file
140 test
.write(['ex4', 'LINGUAS'],"""
145 test
.write(['ex4', 'messages.pot'], pot_contents
)
147 # NOTE: msginit(1) prints all its messages to stderr, we must ignore them,
148 # So, stderr=None is crucial here. It is no point to match stderr to some
149 # specific valuse; the messages are internationalized :) ).
150 test
.run(arguments
= 'po-create', chdir
= 'ex4', stderr
= None)
151 test
.must_exist( ['ex4', 'en.po'] )
152 test
.must_exist( ['ex4', 'pl.po'] )
153 test
.must_contain( ['ex4', 'en.po'], "Hello from a.cpp", mode
='r')
154 test
.must_contain( ['ex4', 'pl.po'], "Hello from a.cpp", mode
='r')
156 ###############################################################################
158 ###############################################################################
160 test
.write( ['ex5', 'SConstruct'],
162 env = Environment( tools = ["default", "msginit"] )
163 env['POAUTOINIT'] = 1
164 env.POInit(['en', 'pl'], LINGUAS_FILE = 1) # needs 'LINGUAS' file
166 test
.write(['ex5', 'LINGUAS'],"""
171 test
.write(['ex5', 'messages.pot'], pot_contents
)
173 # NOTE: msginit(1) prints all its messages to stderr, we must ignore them,
174 # So, stderr=None is crucial here. It is no point to match stderr to some
175 # specific valuse; the messages are internationalized :) ).
176 test
.run(arguments
= 'po-create', chdir
= 'ex5', stderr
= None)
177 test
.must_exist( ['ex5', 'en.po'] )
178 test
.must_exist( ['ex5', 'pl.po'] )
179 test
.must_exist( ['ex5', 'de.po'] )
180 test
.must_exist( ['ex5', 'fr.po'] )
181 test
.must_contain( ['ex5', 'en.po'], "Hello from a.cpp", mode
='r')
182 test
.must_contain( ['ex5', 'pl.po'], "Hello from a.cpp", mode
='r')
183 test
.must_contain( ['ex5', 'de.po'], "Hello from a.cpp", mode
='r')
184 test
.must_contain( ['ex5', 'fr.po'], "Hello from a.cpp", mode
='r')
186 ###############################################################################
188 ###############################################################################
190 test
.write( ['ex6', 'SConstruct'],
192 env = Environment( tools = ["default", "msginit"] )
193 env['POAUTOINIT'] = 1
194 env['LINGUAS_FILE'] = 1
195 env['POTDOMAIN'] = 'foo'
198 test
.write(['ex6', 'LINGUAS'],"""
203 test
.write(['ex6', 'foo.pot'], pot_contents
)
205 # NOTE: msginit(1) prints all its messages to stderr, we must ignore them,
206 # So, stderr=None is crucial here. It is no point to match stderr to some
207 # specific valuse; the messages are internationalized :) ).
208 test
.run(arguments
= 'po-create', chdir
= 'ex6', stderr
= None)
209 test
.must_exist( ['ex6', 'en.po'] )
210 test
.must_exist( ['ex6', 'pl.po'] )
211 test
.must_contain( ['ex6', 'en.po'], "Hello from a.cpp", mode
='r')
212 test
.must_contain( ['ex6', 'pl.po'], "Hello from a.cpp", mode
='r')
219 # indent-tabs-mode:nil
221 # vim: set expandtab tabstop=4 shiftwidth=4: