Browse Source

Changed test and README to use the generic lambda.

yhirose 11 years ago
parent
commit
98e3e7b3c1
3 changed files with 10 additions and 10 deletions
  1. 2 2
      README.md
  2. 3 3
      test/Makefile
  3. 5 5
      test/test.cc

+ 2 - 2
README.md

@@ -20,7 +20,7 @@ Inspired by [Sinatra](http://www.sinatrarb.com/) and [express](https://github.co
 
         Server svr;
 
-        svr.get("/hi", [](const Request& req, Response& res) {
+        svr.get("/hi", [](const auto& req, auto& res) {
             res.set_content("Hello World!", "text/plain");
         });
 
@@ -43,4 +43,4 @@ Client Example
         }
     }
 
-Copyright (c) 2012 Yuji Hirose. All rights reserved.
+Copyright (c) 2014 Yuji Hirose. All rights reserved.

+ 3 - 3
test/Makefile

@@ -3,10 +3,10 @@ USE_CLANG = 1
 
 ifdef USE_CLANG
 CC = clang++
-CCFLAGS = -std=c++0x -stdlib=libc++ -g -DGTEST_USE_OWN_TR1_TUPLE
+CCFLAGS = -std=c++1y -stdlib=libc++ -g -DGTEST_USE_OWN_TR1_TUPLE
 else
-CC = g++-4.7
-CCFLAGS = -std=c++11 -g
+CC = g++-4.9
+CCFLAGS = -std=c++1y -g
 endif
 
 all : test

+ 5 - 5
test/test.cc

@@ -105,15 +105,15 @@ protected:
     virtual void SetUp() {
 		svr_.set_base_dir("./www");
 
-        svr_.get("/hi", [&](const Request& req, Response& res) {
+        svr_.get("/hi", [&](const auto& req, auto& res) {
             res.set_content("Hello World!", "text/plain");
         });
 
-        svr_.get("/", [&](const Request& req, Response& res) {
+        svr_.get("/", [&](const auto& req, auto& res) {
             res.set_redirect("/hi");
         });
 
-        svr_.post("/person", [&](const Request& req, Response& res) {
+        svr_.post("/person", [&](const auto& req, auto& res) {
             if (req.has_param("name") && req.has_param("note")) {
                 persons_[req.params.at("name")] = req.params.at("note");
             } else {
@@ -121,7 +121,7 @@ protected:
             }
         });
 
-        svr_.get("/person/(.*)", [&](const Request& req, Response& res) {
+        svr_.get("/person/(.*)", [&](const auto& req, auto& res) {
             string name = req.matches[1];
             if (persons_.find(name) != persons_.end()) {
                 auto note = persons_[name];
@@ -131,7 +131,7 @@ protected:
             }
         });
 
-        svr_.get("/stop", [&](const Request& req, Response& res) {
+        svr_.get("/stop", [&](const auto& req, auto& res) {
             svr_.stop();
         });