Unit Tests

- Added unit tests to illustrate bug #1136.
This commit is contained in:
Paul Beckingham 2012-12-30 14:44:15 -05:00
parent 5ec68d3e0c
commit 28523e97c6
2 changed files with 9 additions and 3 deletions

View file

@ -497,7 +497,7 @@ void E9::operator_equal (
// Bug 856.
//
// Special case for checking absent projects. Without the explicit "" check
// the right._value.lenghth() is used, which is 0, and therefore generates
// the right._value.length() is used, which is 0, and therefore generates
// a false match.
if (right._value == "")
{

View file

@ -36,7 +36,7 @@ Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (261);
UnitTest t (264);
// void wrapText (std::vector <std::string>& lines, const std::string& text, const int width, bool hyphenate)
std::string text = "This is a test of the line wrapping code.";
std::vector <std::string> lines;
@ -48,7 +48,6 @@ int main (int argc, char** argv)
t.is (lines[3], "wrapping", "wrapText line 3 -> 'wrapping'");
t.is (lines[4], "code.", "wrapText line 4 -> 'code.'");
// void wrapText (std::vector <std::string>& lines, const std::string& text, const int width)
text = "This ☺ is a test of utf8 line extraction.";
lines.clear ();
wrapText (lines, text, 7, true);
@ -61,6 +60,13 @@ int main (int argc, char** argv)
t.is (lines[5], "extrac-", "wrapText line 5 -> 'extrac-'");
t.is (lines[6], "tion.", "wrapText line 6 -> 'tion.'");
text = "one two three\n four";
lines.clear ();
wrapText (lines, text, 13, true);
t.is (lines.size (), (size_t) 2, "wrapText 'one two three\\n four' -> 2 lines");
t.is (lines[0], "one two three", "wrapText line 0 -> 'one two three'");
t.is (lines[1], " four", "wrapText line 1 -> ' four'");
// void extractLine (std::string& text, std::string& line, int length, bool hyphenate)
text = "This ☺ is a test of utf8 line extraction.";
std::string line;