@@ -386,6 +386,64 @@ TEST_CASE("SettingLoggingFileNameStrategy", "[settings]") {
386386 }
387387}
388388
389+ TEST_CASE (" SettingLoggingFormat" , " [settings]" )
390+ {
391+ auto again = DeleteUserSettingsFiles ();
392+
393+ SECTION (" Default value" )
394+ {
395+ UserSettingsTest userSettingTest;
396+
397+ REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::WinGet);
398+ REQUIRE (userSettingTest.GetWarnings ().size () == 0 );
399+ }
400+ SECTION (" WinGet" )
401+ {
402+ std::string_view json = R"( { "logging": { "format": "winget" } })" ;
403+ SetSetting (Stream::PrimaryUserSettings, json);
404+ UserSettingsTest userSettingTest;
405+
406+ REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::WinGet);
407+ REQUIRE (userSettingTest.GetWarnings ().size () == 0 );
408+ }
409+ SECTION (" CCM" )
410+ {
411+ std::string_view json = R"( { "logging": { "format": "ccm" } })" ;
412+ SetSetting (Stream::PrimaryUserSettings, json);
413+ UserSettingsTest userSettingTest;
414+
415+ REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::CCM );
416+ REQUIRE (userSettingTest.GetWarnings ().size () == 0 );
417+ }
418+ SECTION (" Case insensitive CCM" )
419+ {
420+ std::string_view json = R"( { "logging": { "format": "CCM" } })" ;
421+ SetSetting (Stream::PrimaryUserSettings, json);
422+ UserSettingsTest userSettingTest;
423+
424+ REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::CCM );
425+ REQUIRE (userSettingTest.GetWarnings ().size () == 0 );
426+ }
427+ SECTION (" Bad value" )
428+ {
429+ std::string_view json = R"( { "logging": { "format": "cmtrace" } })" ;
430+ SetSetting (Stream::PrimaryUserSettings, json);
431+ UserSettingsTest userSettingTest;
432+
433+ REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::WinGet);
434+ REQUIRE (userSettingTest.GetWarnings ().size () == 1 );
435+ }
436+ SECTION (" Bad value type" )
437+ {
438+ std::string_view json = R"( { "logging": { "format": true } })" ;
439+ SetSetting (Stream::PrimaryUserSettings, json);
440+ UserSettingsTest userSettingTest;
441+
442+ REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::WinGet);
443+ REQUIRE (userSettingTest.GetWarnings ().size () == 1 );
444+ }
445+ }
446+
389447TEST_CASE (" SettingAutoUpdateIntervalInMinutes" , " [settings]" )
390448{
391449 auto again = DeleteUserSettingsFiles ();
@@ -925,64 +983,6 @@ TEST_CASE("SettingOutputSortDirection", "[settings]")
925983 }
926984}
927985
928- TEST_CASE (" SettingLoggingFormat" , " [settings]" )
929- {
930- auto again = DeleteUserSettingsFiles ();
931-
932- SECTION (" Default value" )
933- {
934- UserSettingsTest userSettingTest;
935-
936- REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::WinGet);
937- REQUIRE (userSettingTest.GetWarnings ().size () == 0 );
938- }
939- SECTION (" WinGet" )
940- {
941- std::string_view json = R"( { "logging": { "format": "winget" } })" ;
942- SetSetting (Stream::PrimaryUserSettings, json);
943- UserSettingsTest userSettingTest;
944-
945- REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::WinGet);
946- REQUIRE (userSettingTest.GetWarnings ().size () == 0 );
947- }
948- SECTION (" CCM" )
949- {
950- std::string_view json = R"( { "logging": { "format": "ccm" } })" ;
951- SetSetting (Stream::PrimaryUserSettings, json);
952- UserSettingsTest userSettingTest;
953-
954- REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::CCM );
955- REQUIRE (userSettingTest.GetWarnings ().size () == 0 );
956- }
957- SECTION (" Case insensitive CCM" )
958- {
959- std::string_view json = R"( { "logging": { "format": "CCM" } })" ;
960- SetSetting (Stream::PrimaryUserSettings, json);
961- UserSettingsTest userSettingTest;
962-
963- REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::CCM );
964- REQUIRE (userSettingTest.GetWarnings ().size () == 0 );
965- }
966- SECTION (" Bad value" )
967- {
968- std::string_view json = R"( { "logging": { "format": "cmtrace" } })" ;
969- SetSetting (Stream::PrimaryUserSettings, json);
970- UserSettingsTest userSettingTest;
971-
972- REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::WinGet);
973- REQUIRE (userSettingTest.GetWarnings ().size () == 1 );
974- }
975- SECTION (" Bad value type" )
976- {
977- std::string_view json = R"( { "logging": { "format": true } })" ;
978- SetSetting (Stream::PrimaryUserSettings, json);
979- UserSettingsTest userSettingTest;
980-
981- REQUIRE (userSettingTest.Get <Setting::LoggingFormat>() == LogFileFormat::WinGet);
982- REQUIRE (userSettingTest.GetWarnings ().size () == 1 );
983- }
984- }
985-
986986TEST_CASE (" ConvertToSortField" , " [settings]" )
987987{
988988 SECTION (" Valid values - lowercase" )
0 commit comments