Commit bd56a071 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] use a separate object to pass to a function instead of a temporary

some compilers claim it causes a copy whie it's defined non copyable,
triggering an error.  this fixes some build failure reported by the bots.
should mostly trivial, so committing at my discretion.
parent 1db082c0
...@@ -74,14 +74,15 @@ TEST_F(CacheConfigTest, constructMasterFiles) { ...@@ -74,14 +74,15 @@ TEST_F(CacheConfigTest, constructMasterFiles) {
" \"example.org\": \"file2\"," " \"example.org\": \"file2\","
" \"example.info\": \"file3\"}" " \"example.info\": \"file3\"}"
"}")); "}"));
EXPECT_EQ(3, countZones(CacheConfig("MasterFiles", 0, *config_elem_multi, const CacheConfig cache_conf2("MasterFiles", 0, *config_elem_multi, true);
true))); EXPECT_EQ(3, countZones(cache_conf2));
// A bit unusual, but acceptable case: empty parameters, so no zones. // A bit unusual, but acceptable case: empty parameters, so no zones.
EXPECT_EQ(0, countZones( const CacheConfig cache_conf3("MasterFiles", 0,
CacheConfig("MasterFiles", 0, *Element::fromJSON("{\"cache-enable\": true,"
*Element::fromJSON("{\"cache-enable\": true," " \"params\": {}}"),
" \"params\": {}}"), true))); true);
EXPECT_EQ(0, countZones(cache_conf3));
} }
TEST_F(CacheConfigTest, badConstructMasterFiles) { TEST_F(CacheConfigTest, badConstructMasterFiles) {
...@@ -153,15 +154,16 @@ TEST_F(CacheConfigTest, constructWithMock) { ...@@ -153,15 +154,16 @@ TEST_F(CacheConfigTest, constructWithMock) {
" \"cache-zones\": " " \"cache-zones\": "
"[\"example.com\", \"example.org\",\"example.info\"]" "[\"example.com\", \"example.org\",\"example.info\"]"
"}")); "}"));
EXPECT_EQ(3, countZones(CacheConfig("mock", &mock_client_, const CacheConfig cache_conf2("mock", &mock_client_, *config_elem_multi,
*config_elem_multi, true))); true);
EXPECT_EQ(3, countZones(cache_conf2));
// Empty // Empty
EXPECT_EQ(0, countZones( const CacheConfig cache_conf3(
CacheConfig("mock", &mock_client_, "mock", &mock_client_,
*Element::fromJSON("{\"cache-enable\": true," *Element::fromJSON("{\"cache-enable\": true,"
" \"cache-zones\": []}"), " \"cache-zones\": []}"), true);
true))); EXPECT_EQ(0, countZones(cache_conf3));
// disabled. value of cache-zones are ignored. // disabled. value of cache-zones are ignored.
const ConstElementPtr config_elem_disabled( const ConstElementPtr config_elem_disabled(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment