소스 검색

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 <[email protected]>
Rémi Verschelde 4 년 전
부모
커밋
56100c2dd7
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      tests/test_translation.h

+ 6 - 4
tests/test_translation.h

@@ -60,8 +60,9 @@ TEST_CASE("[Translation] Messages") {
 	translation->get_message_list(&messages);
 	translation->get_message_list(&messages);
 	CHECK(translation->get_message_count() == 2);
 	CHECK(translation->get_message_count() == 2);
 	CHECK(messages.size() == 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") {
 TEST_CASE("[TranslationPO] Messages with context") {
@@ -99,8 +100,9 @@ TEST_CASE("[TranslationPO] Messages with context") {
 	CHECK(translation->get_message_count() == 4);
 	CHECK(translation->get_message_count() == 4);
 	// Only the default context is taken into account.
 	// Only the default context is taken into account.
 	CHECK(messages.size() == 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] Plural messages") {
 TEST_CASE("[TranslationPO] Plural messages") {