@@ -7,13 +7,12 @@ class TestGettext : public TestBase
7
7
public:
8
8
TestGettext () {
9
9
TestManager::registerTestModule (this );
10
- }
10
+ }
11
11
12
12
const char *getName () { return " TestGettext" ; }
13
13
14
14
void runTests (IGameDef *gamedef);
15
15
16
- void testSnfmtgettext ();
17
16
void testFmtgettext ();
18
17
};
19
18
@@ -24,24 +23,21 @@ void TestGettext::runTests(IGameDef *gamedef)
24
23
TEST (testFmtgettext);
25
24
}
26
25
26
+ // Make sure updatepo.sh does not pick up the strings
27
+ #define dummyname fmtgettext
28
+
27
29
void TestGettext::testFmtgettext ()
28
30
{
29
- std::string buf = fmtgettext (" Viewing range changed to %d" , 12 );
30
- UASSERTEQ (std::string, buf, " Viewing range changed to 12" );
31
- buf = fmtgettext (
32
- " You are about to join this server with the name \" %s\" for the "
33
- " first time.\n "
34
- " If you proceed, a new account using your credentials will be "
35
- " created on this server.\n "
36
- " Please retype your password and click 'Register and Join' to "
37
- " confirm account creation, or click 'Cancel' to abort."
38
- , " A" );
39
- UASSERTEQ (std::string, buf,
40
- " You are about to join this server with the name \" A\" for the "
41
- " first time.\n "
42
- " If you proceed, a new account using your credentials will be "
43
- " created on this server.\n "
44
- " Please retype your password and click 'Register and Join' to "
45
- " confirm account creation, or click 'Cancel' to abort."
46
- );
31
+ std::string buf = dummyname (" sample text %d" , 12 );
32
+ UASSERTEQ (std::string, buf, " sample text 12" );
33
+
34
+ std::string src, expect;
35
+ src = " You are about to join this server with the name \" %s\" .\n " ;
36
+ expect = " You are about to join this server with the name \" foo\" .\n " ;
37
+ for (int i = 0 ; i < 20 ; i++) {
38
+ src.append (" loooong text" );
39
+ expect.append (" loooong text" );
40
+ }
41
+ buf = dummyname (src.c_str (), " foo" );
42
+ UASSERTEQ (const std::string &, buf, expect);
47
43
}
0 commit comments