forked from qt-creator/qt-creator
Utils: Turn "Util.asciify" into a plain macro
This monves the asciify function to stringutils and makes it directly available as "asciify:" prefix macro, so that the generation of a default build path does not go through JavaScript. "Util.asciify" remains available as core JavaScript extension for the case that it is used by third party code/wizards. This change also adds a test to tst_stringutils Change-Id: Iba2f20c0415ee8fe757c2f0058a90629b3fbeff0 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -81,6 +81,8 @@ private slots:
|
||||
void testWildcardToRegularExpression();
|
||||
void testSplitAtFirst_data();
|
||||
void testSplitAtFirst();
|
||||
void testAsciify_data();
|
||||
void testAsciify();
|
||||
|
||||
private:
|
||||
TestMacroExpander mx;
|
||||
@@ -438,6 +440,26 @@ void tst_StringUtils::testSplitAtFirst()
|
||||
QCOMPARE(r, right);
|
||||
}
|
||||
|
||||
void tst_StringUtils::testAsciify_data()
|
||||
{
|
||||
QTest::addColumn<QString>("input");
|
||||
QTest::addColumn<QString>("expected");
|
||||
|
||||
QTest::newRow("Basic Latin") << QString("Basic text") << QString("Basic text");
|
||||
QTest::newRow("Control character") << QString("\x07 text") << QString("u0007 text");
|
||||
QTest::newRow("Miscellaneous Technical") << QString("\u23F0 text") << QString("u23f0 text");
|
||||
}
|
||||
|
||||
void tst_StringUtils::testAsciify()
|
||||
{
|
||||
QFETCH(QString, input);
|
||||
QFETCH(QString, expected);
|
||||
|
||||
const QString asciified = Utils::asciify(input);
|
||||
|
||||
QCOMPARE(asciified, expected);
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(tst_StringUtils)
|
||||
|
||||
#include "tst_stringutils.moc"
|
||||
|
||||
Reference in New Issue
Block a user