@@ -494,6 +494,34 @@ void OptionTest::test_options_string_list_custom_delimiters() {
494494 CPPUNIT_ASSERT_EQUAL ((std::vector<std::string>{" Dfirstx" , " DsecondX" }), option3.get_value ());
495495}
496496
497+ void OptionTest::test_options_string_list_to_string () {
498+ OptionStringList option (std::vector<std::string>{" Dfirstx" , " DsecondX" });
499+ CPPUNIT_ASSERT_EQUAL (std::string{" Dfirstx,DsecondX" }, option.get_value_string ());
500+
501+ option.set (Option::Priority::RUNTIME, std::vector<std::string>{" " , " DsecondX" });
502+ CPPUNIT_ASSERT_EQUAL (std::string{" \\ ,DsecondX" }, option.get_value_string ());
503+
504+ option.set (Option::Priority::RUNTIME, std::vector<std::string>{" asdasd" , " " , " DsecondX" });
505+ CPPUNIT_ASSERT_EQUAL (std::string{" asdasd,\\ ,DsecondX" }, option.get_value_string ());
506+
507+ option.set (Option::Priority::RUNTIME, std::vector<std::string>{" asdasd" , " ," , " \\ DsecondX" });
508+ CPPUNIT_ASSERT_EQUAL (std::string{" asdasd,\\ ,,\\\\ DsecondX" }, option.get_value_string ());
509+
510+ option.set (Option::Priority::RUNTIME, std::vector<std::string>{" asdasd, " , " DsecondX" });
511+ CPPUNIT_ASSERT_EQUAL (std::string{" \\ asdasd\\ ,\\ ,DsecondX" }, option.get_value_string ());
512+ }
513+
514+ void OptionTest::test_options_string_list_custom_delimiters_to_string () {
515+ OptionStringList option (std::vector<std::string>{" aa; b" , " ccc," }, " " , true , " ;" );
516+ CPPUNIT_ASSERT_EQUAL (std::string{" aa\\ ; b;ccc," }, option.get_value_string ());
517+
518+ option.set (Option::Priority::RUNTIME, std::vector<std::string>{" " , " ;aa; :b" , " ccc," });
519+ CPPUNIT_ASSERT_EQUAL (std::string{" ;\\ ;aa\\ ; :b;ccc," }, option.get_value_string ());
520+
521+ OptionStringList option2 (std::vector<std::string>{" " , " ;a\\ a; :b" , " ccc," }, " " , true , " ;:" );
522+ CPPUNIT_ASSERT_EQUAL (std::string{" ;\\ ;a\\\\ a\\ ; \\ :b;ccc," }, option2.get_value_string ());
523+ }
524+
497525void OptionTest::test_options_string_set () {
498526 const OptionStringSet::ValueType initial{" x" , " y" , " z" };
499527 OptionStringSet option (initial);
0 commit comments