@@ -359,6 +359,38 @@ TEST_F(ProgramOptionsTest, mandatory_option_asked_when_not_provided) {
359359 EXPECT_EQ (std::string (" input" ), a.value ());
360360}
361361
362+ TEST_F (ProgramOptionsTest, multi_line_input_parsed_correctly) {
363+ int argc = 1 ;
364+ const char * argv[] = { " programoptions" };
365+ std::stringstream str (" input input2 input3" );
366+ Cli po (argc, argv);
367+ po.UserInputRequiredForAbsentMandatoryOptions ();
368+ po.Add (" -a" , " --alpha" , " Option A" , true );
369+ po.ChangeIO (&std::cout, &str);
370+
371+ po.ParseArguments ();
372+
373+ auto a = po.GetOption (" -a" );
374+ EXPECT_EQ (true , a.exists ());
375+ EXPECT_EQ (std::string (" input input2 input3" ), a.value ());
376+ }
377+
378+ TEST_F (ProgramOptionsTest, multi_line_double_parsed_correctly) {
379+ int argc = 1 ;
380+ const char * argv[] = { " programoptions" };
381+ std::stringstream str (" 15.87396509125677 \r\n " );
382+ Cli po (argc, argv);
383+ po.UserInputRequiredForAbsentMandatoryOptions ();
384+ po.Add (" -a" , " --alpha" , " Option A" , true );
385+ po.ChangeIO (&std::cout, &str);
386+
387+ po.ParseArguments ();
388+
389+ auto a = po.GetOption (" -a" );
390+ EXPECT_EQ (true , a.exists ());
391+ EXPECT_EQ (15.87396509125677 , a.value_as <double >());
392+ }
393+
362394TEST_F (ProgramOptionsTest, function_option_executes_successfully) {
363395 bool executed = false ;
364396 int argc = 2 ;
0 commit comments