@ -40,7 +40,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame=save.omwsave " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_single_word_load_savegame_path )
@ -49,7 +49,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , " save.omwsave " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_multi_component_load_savegame_path )
@ -58,7 +58,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , " /home/user/openmw/save.omwsave " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " /home/user/openmw/save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " /home/user/openmw/save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_windows_multi_component_load_savegame_path )
@ -67,7 +67,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , R " (C: \ OpenMW \ save.omwsave) " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (C: \ OpenMW \ save.omwsave) " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (C: \ OpenMW \ save.omwsave) " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_load_savegame_path_with_spaces )
@ -76,8 +76,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , " my save.omwsave " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : ReluctantPath > ( ) . string ( ) , " my " ) ;
// EXPECT_EQ(variables["load-savegame"].as<Files::ReluctantPath>().string(), "my save.omwsave");
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuotedPath > ( ) . string ( ) , " my save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_load_savegame_path_with_octothorpe )
@ -86,7 +85,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , " my#save.omwsave " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " my#save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " my#save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_load_savegame_path_with_at_sign )
@ -95,7 +94,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , " my@save.omwsave " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " my@save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " my@save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_load_savegame_path_with_quote )
@ -104,7 +103,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , R " (my " save . omwsave ) " };
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (my " save . omwsave ) " );
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (my " save . omwsave ) " );
}
TEST ( OpenMWOptionsFromArguments , should_support_quoted_load_savegame_path )
@ -113,8 +112,8 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , R " ( " save " .omwsave) " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (save) " ) ;
// EXPECT_EQ(variables["load-savegame"].as<Files:: Reluctant Path>().string(), R"("save".omwsave)");
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (save) " ) ;
// EXPECT_EQ(variables["load-savegame"].as<Files:: MaybeQuoted Path>().string(), R"("save".omwsave)");
}
TEST ( OpenMWOptionsFromArguments , should_support_quoted_load_savegame_path_with_escaped_quote_by_ampersand )
@ -123,7 +122,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , R " ( " save & " .omwsave " ) " };
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (save " . omwsave ) " );
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (save " . omwsave ) " );
}
TEST ( OpenMWOptionsFromArguments , should_support_quoted_load_savegame_path_with_escaped_ampersand )
@ -132,7 +131,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , R " ( " save . omwsave & & " ) " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save.omwsave& " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save.omwsave& " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_load_savegame_path_with_ampersand )
@ -141,7 +140,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , " save&.omwsave " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save&.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save&.omwsave " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_support_load_savegame_path_with_multiple_quotes )
@ -150,7 +149,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , R " (my " save " .omwsave) " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (my " save " .omwsave) " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (my " save " .omwsave) " ) ;
}
TEST ( OpenMWOptionsFromArguments , should_compose_data )
@ -159,7 +158,7 @@ namespace
const std : : array arguments { " openmw " , " --data " , " 1 " , " --data " , " 2 " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_THAT ( variables [ " data " ] . as < Files : : Reluctant PathContainer> ( ) , ElementsAre ( IsPath ( " 1 " ) , IsPath ( " 2 " ) ) ) ;
EXPECT_THAT ( variables [ " data " ] . as < Files : : MaybeQuoted PathContainer> ( ) , ElementsAre ( IsPath ( " 1 " ) , IsPath ( " 2 " ) ) ) ;
}
TEST ( OpenMWOptionsFromArguments , should_compose_data_from_single_flag )
@ -168,7 +167,7 @@ namespace
const std : : array arguments { " openmw " , " --data " , " 1 " , " 2 " } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_THAT ( variables [ " data " ] . as < Files : : Reluctant PathContainer> ( ) , ElementsAre ( IsPath ( " 1 " ) , IsPath ( " 2 " ) ) ) ;
EXPECT_THAT ( variables [ " data " ] . as < Files : : MaybeQuoted PathContainer> ( ) , ElementsAre ( IsPath ( " 1 " ) , IsPath ( " 2 " ) ) ) ;
}
TEST ( OpenMWOptionsFromArguments , should_throw_on_multiple_load_savegame )
@ -189,7 +188,7 @@ namespace
const std : : array arguments { " openmw " , " --load-savegame " , pathArgument . c_str ( ) } ;
bpo : : variables_map variables ;
parseArgs ( arguments , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , path ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , path ) ;
}
INSTANTIATE_TEST_SUITE_P (
@ -204,7 +203,7 @@ namespace
std : : istringstream stream ( " load-savegame=save.omwsave " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_strip_quotes_from_load_savegame_path )
@ -213,7 +212,7 @@ namespace
std : : istringstream stream ( R " (load-savegame= " save . omwsave " ) " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_strip_outer_quotes_from_load_savegame_path )
@ -222,8 +221,8 @@ namespace
std : : istringstream stream ( R " (load-savegame= " " save " . omwsave " ) " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " " ) ;
// EXPECT_EQ(variables["load-savegame"].as<Files:: Reluctant Path>().string(), R"(""save".omwsave")");
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " " ) ;
// EXPECT_EQ(variables["load-savegame"].as<Files:: MaybeQuoted Path>().string(), R"(""save".omwsave")");
}
TEST ( OpenMWOptionsFromConfig , should_strip_quotes_from_load_savegame_path_with_space )
@ -232,7 +231,7 @@ namespace
std : : istringstream stream ( R " (load-savegame= " my save . omwsave " ) " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " my save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " my save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_support_quoted_load_savegame_path_with_octothorpe )
@ -241,7 +240,7 @@ namespace
std : : istringstream stream ( " load-savegame=save#.omwsave " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save#.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save#.omwsave " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_support_quoted_load_savegame_path_with_at_sign )
@ -250,7 +249,7 @@ namespace
std : : istringstream stream ( " load-savegame=save@.omwsave " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save@.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save@.omwsave " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_support_quoted_load_savegame_path_with_quote )
@ -259,7 +258,7 @@ namespace
std : : istringstream stream ( R " (load-savegame=save " . omwsave ) " );
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (save " . omwsave ) " );
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (save " . omwsave ) " );
}
TEST ( OpenMWOptionsFromConfig , should_support_confusing_savegame_path_with_lots_going_on )
@ -268,7 +267,7 @@ namespace
std : : istringstream stream ( R " (load-savegame= " one & " two " three " .omwsave " ) " );
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (one " two ) " );
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (one " two ) " );
}
TEST ( OpenMWOptionsFromConfig , should_support_confusing_savegame_path_with_even_more_going_on )
@ -277,7 +276,7 @@ namespace
std : : istringstream stream ( R " (load-savegame= " one & " two " three " .omwsave " ) " );
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (one " two ) " );
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (one " two ) " );
}
TEST ( OpenMWOptionsFromConfig , should_ignore_commented_option )
@ -286,7 +285,7 @@ namespace
std : : istringstream stream ( " #load-savegame=save.omwsave " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_ignore_whitespace_prefixed_commented_option )
@ -295,7 +294,7 @@ namespace
std : : istringstream stream ( " \t #load-savegame=save.omwsave " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_support_whitespace_around_option )
@ -304,7 +303,7 @@ namespace
std : : istringstream stream ( " load-savegame = save.omwsave " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_throw_on_multiple_load_savegame )
@ -321,7 +320,7 @@ namespace
std : : istringstream stream ( " load-savegame=/home/user/openmw/save.omwsave " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " /home/user/openmw/save.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " /home/user/openmw/save.omwsave " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_support_windows_multi_component_load_savegame_path )
@ -330,7 +329,7 @@ namespace
std : : istringstream stream ( R " (load-savegame=C: \ OpenMW \ save.omwsave) " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (C: \ OpenMW \ save.omwsave) " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (C: \ OpenMW \ save.omwsave) " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_compose_data )
@ -339,7 +338,7 @@ namespace
std : : istringstream stream ( " data=1 \n data=2 " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_THAT ( variables [ " data " ] . as < Files : : Reluctant PathContainer> ( ) , ElementsAre ( IsPath ( " 1 " ) , IsPath ( " 2 " ) ) ) ;
EXPECT_THAT ( variables [ " data " ] . as < Files : : MaybeQuoted PathContainer> ( ) , ElementsAre ( IsPath ( " 1 " ) , IsPath ( " 2 " ) ) ) ;
}
TEST ( OpenMWOptionsFromConfig , should_support_quoted_load_savegame_path_with_escaped_quote_by_ampersand )
@ -348,7 +347,7 @@ namespace
std : : istringstream stream ( R " (load-savegame= " save & " .omwsave " ) " );
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , R " (save " . omwsave ) " );
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , R " (save " . omwsave ) " );
}
TEST ( OpenMWOptionsFromConfig , should_support_quoted_load_savegame_path_with_escaped_ampersand )
@ -357,7 +356,7 @@ namespace
std : : istringstream stream ( R " (load-savegame= " save . omwsave & & " ) " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save.omwsave& " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save.omwsave& " ) ;
}
TEST ( OpenMWOptionsFromConfig , should_support_load_savegame_path_with_ampersand )
@ -366,7 +365,7 @@ namespace
std : : istringstream stream ( " load-savegame=save&.omwsave " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , " save&.omwsave " ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , " save&.omwsave " ) ;
}
struct OpenMWOptionsFromConfigStrings : TestWithParam < std : : string > { } ;
@ -378,7 +377,7 @@ namespace
std : : istringstream stream ( " load-savegame= \" " + path + " \" " ) ;
bpo : : variables_map variables ;
Files : : parseConfig ( stream , variables , description ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : Reluctant Path> ( ) . string ( ) , path ) ;
EXPECT_EQ ( variables [ " load-savegame " ] . as < Files : : MaybeQuoted Path> ( ) . string ( ) , path ) ;
}
INSTANTIATE_TEST_SUITE_P (