diff options
-rw-r--r-- | tests/test_misc.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_misc.cc b/tests/test_misc.cc index 1adb77d0..1202de6c 100644 --- a/tests/test_misc.cc +++ b/tests/test_misc.cc @@ -1,6 +1,6 @@ // Miscellaneous tests. // -// Copyright (C) 2005 Daniel Burrows +// Copyright (C) 2005, 2007 Daniel Burrows // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -27,6 +27,7 @@ class MiscTest : public CppUnit::TestFixture CPPUNIT_TEST(testStripWS); CPPUNIT_TEST(testOrderlessLt); + CPPUNIT_TEST(test_ssprintf); CPPUNIT_TEST_SUITE_END(); private: @@ -94,6 +95,16 @@ private: CPPUNIT_ASSERT(!cmp(d, c)); CPPUNIT_ASSERT(!cmp(e, d)); } + + void test_ssprintf() + { + // Test that inserting very long strings via ssprintf actually works. + std::string horriblelongthing = "abcdefghijklmnopqrstuvwxyz"; + while(horriblelongthing.size() < 4096) + horriblelongthing += horriblelongthing; + + CPPUNIT_ASSERT_EQUAL(horriblelongthing + " 20", ssprintf("%s %d", horriblelongthing.c_str(), 20)); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(MiscTest); |