Skip to content

Commit 6624e86

Browse files
committed
[http] add text info to test
All gtest macros like EXPECT_EQ can be supplied with output to explain that is checked. One than see such output in case of problem in log.
1 parent ef08287 commit 6624e86

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

net/http/test/test_server.cxx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ TEST(THttpServer, main)
8787
" \"fBits\" : 8,\n"
8888
" \"fName\" : \"obj1\",\n"
8989
" \"fTitle\" : \"title1\"\n"
90-
"}");
90+
"}") << "result of root.json request";
9191

9292
// check XML representation for the object
9393
res = execute_request("/obj1/root.xml");
@@ -97,18 +97,18 @@ TEST(THttpServer, main)
9797
" <fName str=\"obj1\"/>\n"
9898
" <fTitle str=\"title1\"/>\n"
9999
" </TNamed>\n"
100-
"</Object>\n");
100+
"</Object>\n") << "result of root.xml request";
101101

102102

103103
// check BINARY representation for the object
104104
res = execute_request("/obj1/root.bin");
105105
// keep minimal margin for binary format change
106-
EXPECT_NEAR(res.length(), 28, 4);
106+
EXPECT_NEAR(res.length(), 28, 4) << "size of root.bin request";
107107

108108
// check ROOT file creation
109109
res = execute_request("/obj1/file.root");
110110
// TODO: anlyze why so big size for small object
111-
EXPECT_NEAR(res.length(), 1024, 100);
111+
EXPECT_NEAR(res.length(), 1024, 100) << "size of file.root request";
112112

113113
// check item request hierarchy request
114114
res = execute_request("/obj1/item.json");
@@ -118,7 +118,7 @@ TEST(THttpServer, main)
118118
" \"_root_version\" : " + std::to_string(gROOT->GetVersionCode()) + ",\n"
119119
" \"_kind\" : \"ROOT.TNamed\",\n"
120120
" \"_title\" : \"title1\"\n"
121-
"}");
121+
"}") << "result of item.json request";
122122

123123

124124
// check multi request to several objects
@@ -135,23 +135,23 @@ TEST(THttpServer, main)
135135
" \"fBits\" : 8,\n"
136136
" \"fName\" : \"obj2\",\n"
137137
" \"fTitle\" : \"title2\"\n"
138-
"}]");
138+
"}]") << "result of multi.json request";
139139

140140

141141
// by default methods execution is not allowed
142142
res = execute_request("/obj1/exe.json?method=GetTitle");
143-
EXPECT_EQ(res, "");
143+
EXPECT_EQ(res, "") << "exe.json should be empty in readonly";
144144

145145

146146
// disable readonly to get extra functionality
147147
serv.SetReadOnly(kFALSE);
148148

149149
// only now one can execute method
150150
res = execute_request("/obj1/exe.json?method=GetTitle");
151-
EXPECT_EQ(res, "\"title1\"");
151+
EXPECT_EQ(res, "\"title1\"") << "result of exe.json with object title";
152152

153153
res = execute_request("/obj1/exe.json?method=SetTitle&title=NewTitle");
154-
EXPECT_EQ(res, "null");
155-
EXPECT_EQ(std::string("NewTitle"), obj1.GetTitle());
154+
EXPECT_EQ(res, "null") << "returns null when executes void method";
155+
EXPECT_EQ(std::string("NewTitle"), obj1.GetTitle()) << "title must match with submitted value";
156156
obj1.SetTitle("title1");
157157
}

0 commit comments

Comments
 (0)