From b37c6febad44ba62bb089eea35a1ae71104a9334 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 4 Jan 2016 16:09:45 +0300 Subject: Add tests for translation checks. --- tests/testreport.txt | 2 ++ tests/testsrc/bad/translation.cpp | 33 +++++++++++++++++++++++++++++++++ tests/testsrc/good/translation.cpp | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 tests/testsrc/bad/translation.cpp create mode 100644 tests/testsrc/good/translation.cpp diff --git a/tests/testreport.txt b/tests/testreport.txt index 94223aa..b555001 100644 --- a/tests/testreport.txt +++ b/tests/testreport.txt @@ -42,6 +42,8 @@ [testsrc/bad/license6.cpp:5]: V005: Missing "This file is part of The ManaPlus Client." [testsrc/bad/license6.h:5]: V005: Missing "This file is part of The ManaPlus Client." [testsrc/bad/packet.cpp:25]: V012: Wrong output packet creation. Must be 'createOutPacket(CMSG...' +[testsrc/bad/translation.cpp:27]: V014: Missing "// TRANSLATORS: " comment before this line. +[testsrc/bad/translation.cpp:32]: V014: Missing "// TRANSLATORS: " comment before this line. [testsrc/bad/uk.po:2257]: V010: Wrong character at end of translation line. [testsrc/bad/uk.po:2269]: V010: Wrong character at start of translation line. [testsrc/bad/uk.po:2535]: V010: Wrong number of spaces at start of translation line. diff --git a/tests/testsrc/bad/translation.cpp b/tests/testsrc/bad/translation.cpp new file mode 100644 index 0000000..ce72e76 --- /dev/null +++ b/tests/testsrc/bad/translation.cpp @@ -0,0 +1,33 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "debug.h" + +void Test1() +{ + // TRANSLATORS: test line + int k; + std::string str = _("This is text line"); +} + +void Test2() +{ + std::string str = _("This is text line"); +} diff --git a/tests/testsrc/good/translation.cpp b/tests/testsrc/good/translation.cpp new file mode 100644 index 0000000..dfbe647 --- /dev/null +++ b/tests/testsrc/good/translation.cpp @@ -0,0 +1,34 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "debug.h" + +void Test1() +{ + // TRANSLATORS: test line + std::string str = _("This is text line"); +} + +void Test2() +{ + // TRANSLATORS: test line + // second line + std::string str = _("This is text line"); +} -- cgit v1.2.3-60-g2f50