summaryrefslogtreecommitdiffstats
path: root/src/test/common/test_htmlformatter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/common/test_htmlformatter.cc')
-rw-r--r--src/test/common/test_htmlformatter.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/common/test_htmlformatter.cc b/src/test/common/test_htmlformatter.cc
new file mode 100644
index 00000000000..0a8d827b53a
--- /dev/null
+++ b/src/test/common/test_htmlformatter.cc
@@ -0,0 +1,26 @@
+#include "gtest/gtest.h"
+
+#include "common/HTMLFormatter.h"
+#include <sstream>
+#include <string>
+
+using namespace ceph;
+
+TEST(htmlformatter, dump_format_large_item)
+{
+ std::stringstream sout;
+ HTMLFormatter formatter(false);
+
+ std::string base_url("http://example.com");
+ std::string bucket_name("bucket");
+ std::string object_key(1024, 'a');
+
+ formatter.dump_format("Location", "%s/%s/%s", base_url.c_str(), bucket_name.c_str(), object_key.c_str());
+
+ formatter.flush(sout);
+
+ std::string uri = base_url + "/" + bucket_name + "/" + object_key;
+ std::string expected_output = "<li>Location: " + uri + "</li>";
+
+ EXPECT_EQ(expected_output, sout.str());
+} \ No newline at end of file