|
Boost-Commit : |
From: lists.drrngrvy_at_[hidden]
Date: 2008-04-19 09:32:06
Author: drrngrvy
Date: 2008-04-19 09:32:06 EDT (Sat, 19 Apr 2008)
New Revision: 44576
URL: http://svn.boost.org/trac/boost/changeset/44576
Log:
Add a test which uses wget to check the output of the *cgi_hello_world examples through a server. It's not used by default, but has the BBv2 id of wget_test.
Added:
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/hello_world.cpp (contents, props changed)
Added: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/hello_world.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/hello_world.cpp 2008-04-19 09:32:06 EDT (Sat, 19 Apr 2008)
@@ -0,0 +1,44 @@
+
+#include <cstdlib>
+
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
+#define BOOST_TEST_MODULE hello_world_test
+#include <boost/test/unit_test.hpp>
+
+using namespace std;
+using namespace boost;
+namespace fs = boost::filesystem;
+
+void check_output( string const& example, string const& output )
+{
+ string wget_cmd ("wget localhost/");
+ if (example.substr(0,4) == "fcgi")
+ {
+ wget_cmd += "fcgi/";
+ }
+ else
+ {
+ wget_cmd += "cgi-bin/";
+ }
+ wget_cmd += example;
+
+ std::system(wget_cmd.c_str());
+ BOOST_CHECK( fs::exists(example) );
+ BOOST_CHECK( fs::is_regular(example) );
+ fs::ifstream ifs(example);
+ string s;
+ getline(ifs, s);
+ BOOST_CHECK_EQUAL( s, output);
+ fs::remove(example);
+}
+
+BOOST_AUTO_TEST_CASE( hello_world_test )
+{
+ string output ("Hello there, universe.");
+ check_output("acgi_hello_world", output);
+ check_output("cgi_hello_world", output);
+ check_output("fcgi_hello_world", output);
+}
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk