Skip to content

Commit

Permalink
tst_QLocale::dayName(): Convert some dangling code into test rows
Browse files Browse the repository at this point in the history
Every test row was following its locale-specific test with tests for
Irish and Greek day names, repeated regardless of the locale-specific
data. Express these tests as rows in their own right and shorten the
per-row testing, so we only do each once.

Change-Id: I8f919b50ac54423bacab6e5a9d34254b7db59a55
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
ediosyncratic committed Jan 29, 2024
1 parent cee1c62 commit e657c31
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/auto/corelib/text/qlocale/tst_qlocale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3082,6 +3082,18 @@ void tst_QLocale::dayName_data()
<< QString("ru_RU") << QString::fromUtf8("\320\262\321\201") << 7 << QLocale::ShortFormat;
QTest::newRow("ru_RU narrow")
<< QString("ru_RU") << u"\u0412"_s << 7 << QLocale::NarrowFormat;

QTest::newRow("ga_IE/Mon") << QString("ga_IE") << QString("Luan") << 1 << QLocale::ShortFormat;
QTest::newRow("ga_IE/Sun") << QString("ga_IE") << QString("Domh") << 7 << QLocale::ShortFormat;
QTest::newRow("el_GR/Tue")
<< QString("el_GR") << QString::fromUtf8("\316\244\317\201\316\257")
<< 2 << QLocale::ShortFormat;
QTest::newRow("el_GR/Thu")
<< QString("el_GR") << QString::fromUtf8("\316\240\316\255\316\274")
<< 4 << QLocale::ShortFormat;
QTest::newRow("el_GR/Sat")
<< QString("el_GR") << QString::fromUtf8("\316\243\316\254\316\262")
<< 6 << QLocale::ShortFormat;
}

void tst_QLocale::dayName()
Expand All @@ -3093,15 +3105,6 @@ void tst_QLocale::dayName()

QLocale l(locale_name);
QCOMPARE(l.dayName(day, format), dayName);

QLocale ir("ga_IE");
QCOMPARE(ir.dayName(1, QLocale::ShortFormat), QLatin1String("Luan"));
QCOMPARE(ir.dayName(7, QLocale::ShortFormat), QLatin1String("Domh"));

QLocale gr("el_GR");
QCOMPARE(gr.dayName(2, QLocale::ShortFormat), QString::fromUtf8("\316\244\317\201\316\257"));
QCOMPARE(gr.dayName(4, QLocale::ShortFormat), QString::fromUtf8("\316\240\316\255\316\274"));
QCOMPARE(gr.dayName(6, QLocale::ShortFormat), QString::fromUtf8("\316\243\316\254\316\262"));
}

void tst_QLocale::standaloneDayName_data()
Expand Down

0 comments on commit e657c31

Please sign in to comment.