Ignore:
Timestamp:
Nov 27, 2010, 1:09:14 AM (11 years ago)
Author:
Peter
Message:

fixes #645. error message is now: invalid argument --bar'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/commandline_test.cc

    r2202 r2352  
    437437  }
    438438
     439  // test for ticket 645
     440  suite.err() << "Testing error message with -n STRING\n";
     441  try {
     442    int ac = 3;
     443    const char* cav[] = { "test_prog", "-n", "STRING"};
     444    char** av = stradup(cav, ac);
     445    try {
     446      cmd.parse(ac,av);
     447      strafree(av, ac);
     448      ok=false;
     449      suite.err() << "error: expected parse to throw\n";
     450    }
     451    catch (std::runtime_error& e) {
     452      strafree(av, ac);
     453      suite.err() << "expected exception: what(): " << e.what() << "\n";
     454    }
     455  }
     456  catch (std::runtime_error& e) {
     457    suite.err() << "failed: " << e.what() << "\n";
     458    ok=false;
     459  }
    439460  return ok;
    440461}
Note: See TracChangeset for help on using the changeset viewer.