Ignore:
Timestamp:
Sep 2, 2008, 5:17:32 AM (13 years ago)
Author:
Peter
Message:

fixes #418

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/commandline_test.cc

    r1437 r1465  
    155155  OptionArg<std::string> input(cmd, "i,input", "input file");
    156156  OptionArg<unsigned int> n(cmd, "n", "number of lines");
    157   OptionArg<double> x(cmd, "x", "a float number");
     157  OptionArg<double> x(cmd, "x,extra", "a float number");
    158158
    159159  suite.err() << "Testing OptionArg existence -i file...";
     
    264264  }
    265265  catch (std::runtime_error& e) {
     266    ok = false;
    266267    suite.err() << "failed\nexception thrown with what(): " << e.what() << "\n";
    267     suite.err() << "Error: this is an expected error; see ticket:418\n";
    268   }
    269 
     268  }
     269
     270  suite.err() << "Testing OptionArg double value --extra -6...";
     271  try {
     272    int ac = 3;
     273    char* av[] = { "test_prog", "--extra", "-6" };
     274    cmd.parse(ac,av);
     275    if (x.value()==-6)
     276      suite.err() << "ok\n";
     277    else {
     278      suite.err() << "failed\n";
     279      ok =false;
     280    }
     281  }
     282  catch (std::runtime_error& e) {
     283    ok=false;
     284    suite.err() << "failed\nexception thrown with what(): " << e.what() << "\n";
     285  }
    270286
    271287  return ok;
Note: See TracChangeset for help on using the changeset viewer.