Bug Fix - blank annotations now disallowed

- Prevented blank annotations from being added, and the description
  being echoed as though it were the annotation applied (thanks to
  Bruce Dillahunty).
- Added bug.annotate.t unit test to prevent regression.
This commit is contained in:
Paul Beckingham
2009-05-27 01:01:25 -04:00
parent 8dd9690a65
commit 0fcaf85652
6 changed files with 73 additions and 10 deletions

View File

@@ -584,16 +584,6 @@ void T::parse (const std::string& line)
// If this code is inaccurate, data corruption ensues.
int T::determineVersion (const std::string& line)
{
// Version 1 looks like:
//
// [tags] [attributes] description\n
// X [tags] [attributes] description\n
//
// Scan for the first character being either the bracket or X.
if ((line[0] == '[' && line[line.length () - 1] != ']') ||
line.find ("X [") != std::string::npos)
return 1;
// Version 2 looks like:
//
// uuid status [tags] [attributes] description\n
@@ -627,6 +617,16 @@ int T::determineVersion (const std::string& line)
return 2;
}
// Version 1 looks like:
//
// [tags] [attributes] description\n
// X [tags] [attributes] description\n
//
// Scan for the first character being either the bracket or X.
else if ((line[0] == '[' && line[line.length () - 1] != ']') ||
line.find ("X [") == 0)
return 1;
// Version 4 looks like:
//
// [name:"value" ...]