summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-05-17 12:29:24 +0200
committerRémi Verschelde <rverschelde@gmail.com>2021-05-17 12:40:15 +0200
commit56100c2dd7584113530ea19639d25fce6bc23d62 (patch)
tree0fddcb2bb7e31d21ddf49e5cf5a5287bbe9ecb80
parent2be9b5dec49ffb3122f766e1d4c9cd2088fde272 (diff)
Tests: Don't assume translation map ordering
This lead to randomly failing the test as the insertion order is not preserved by Map. Follow-up to #48778. Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
-rw-r--r--tests/test_translation.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test_translation.h b/tests/test_translation.h
index 8ebe9ebe1e..52ff49bf9b 100644
--- a/tests/test_translation.h
+++ b/tests/test_translation.h
@@ -60,8 +60,9 @@ TEST_CASE("[Translation] Messages") {
translation->get_message_list(&messages);
CHECK(translation->get_message_count() == 2);
CHECK(messages.size() == 2);
- CHECK(messages[0] == "Hello2");
- CHECK(messages[1] == "Hello3");
+ // Messages are stored in a Map, don't assume ordering.
+ CHECK(messages.find("Hello2"));
+ CHECK(messages.find("Hello3"));
}
TEST_CASE("[TranslationPO] Messages with context") {
@@ -99,8 +100,9 @@ TEST_CASE("[TranslationPO] Messages with context") {
CHECK(translation->get_message_count() == 4);
// Only the default context is taken into account.
CHECK(messages.size() == 2);
- CHECK(messages[0] == "Hello2");
- CHECK(messages[1] == "Hello3");
+ // Messages are stored in a Map, don't assume ordering.
+ CHECK(messages.find("Hello2"));
+ CHECK(messages.find("Hello3"));
}
TEST_CASE("[TranslationPO] Plural messages") {