KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_translation_format_strings.cpp File Reference

Guards against issue 23973. More...

#include <boost/test/unit_test.hpp>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/textfile.h>
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <map>
#include <set>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

 BOOST_AUTO_TEST_CASE (NoExtraFormatSpecifiers)
 A non-fuzzy translation of a format-string msgid must not add argument-consuming specifiers, else wxString::Format() reads past its arguments and crashes (issue 23973).
 

Detailed Description

Guards against issue 23973.

KiCad feeds translated strings into wxString::Format(), which does not check that a translation's printf specifiers match the supplied argument count. A translation carrying more consuming specifiers than its msgid makes Format() read past the argument list and crash. This test fails if any non-fuzzy translation adds specifiers beyond those in its msgid.

Definition in file test_translation_format_strings.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE()

BOOST_AUTO_TEST_CASE ( NoExtraFormatSpecifiers )

A non-fuzzy translation of a format-string msgid must not add argument-consuming specifiers, else wxString::Format() reads past its arguments and crashes (issue 23973).

Definition at line 309 of file test_translation_format_strings.cpp.

References BOOST_AUTO_TEST_CASE(), and BOOST_CHECK_EQUAL().