aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/tests/compression.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-01-17 22:20:05 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-01-18 11:12:30 +0100
commitd62a9390fcdc0f9e4971e5fab2f667567237b252 (patch)
treecdbf6aef8b15b2ba5f02f7426ec2e5cd1f595e39 /src/libutil/tests/compression.cc
parent52ee7ec0028263f04e15c05256ca90fa62a0da66 (diff)
Get rid of std::shared_ptr<std::string> and ref<std::string>
These were needed back in the pre-C++11 era because we didn't have move semantics. But now we do.
Diffstat (limited to 'src/libutil/tests/compression.cc')
-rw-r--r--src/libutil/tests/compression.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/libutil/tests/compression.cc b/src/libutil/tests/compression.cc
index 2efa3266b..bbbf3500f 100644
--- a/src/libutil/tests/compression.cc
+++ b/src/libutil/tests/compression.cc
@@ -12,17 +12,17 @@ namespace nix {
}
TEST(compress, noneMethodDoesNothingToTheInput) {
- ref<std::string> o = compress("none", "this-is-a-test");
+ auto o = compress("none", "this-is-a-test");
- ASSERT_EQ(*o, "this-is-a-test");
+ ASSERT_EQ(o, "this-is-a-test");
}
TEST(decompress, decompressNoneCompressed) {
auto method = "none";
auto str = "slfja;sljfklsa;jfklsjfkl;sdjfkl;sadjfkl;sdjf;lsdfjsadlf";
- ref<std::string> o = decompress(method, str);
+ auto o = decompress(method, str);
- ASSERT_EQ(*o, str);
+ ASSERT_EQ(o, str);
}
TEST(decompress, decompressEmptyCompressed) {
@@ -30,33 +30,33 @@ namespace nix {
// (Content-Encoding == "").
auto method = "";
auto str = "slfja;sljfklsa;jfklsjfkl;sdjfkl;sadjfkl;sdjf;lsdfjsadlf";
- ref<std::string> o = decompress(method, str);
+ auto o = decompress(method, str);
- ASSERT_EQ(*o, str);
+ ASSERT_EQ(o, str);
}
TEST(decompress, decompressXzCompressed) {
auto method = "xz";
auto str = "slfja;sljfklsa;jfklsjfkl;sdjfkl;sadjfkl;sdjf;lsdfjsadlf";
- ref<std::string> o = decompress(method, *compress(method, str));
+ auto o = decompress(method, compress(method, str));
- ASSERT_EQ(*o, str);
+ ASSERT_EQ(o, str);
}
TEST(decompress, decompressBzip2Compressed) {
auto method = "bzip2";
auto str = "slfja;sljfklsa;jfklsjfkl;sdjfkl;sadjfkl;sdjf;lsdfjsadlf";
- ref<std::string> o = decompress(method, *compress(method, str));
+ auto o = decompress(method, compress(method, str));
- ASSERT_EQ(*o, str);
+ ASSERT_EQ(o, str);
}
TEST(decompress, decompressBrCompressed) {
auto method = "br";
auto str = "slfja;sljfklsa;jfklsjfkl;sdjfkl;sadjfkl;sdjf;lsdfjsadlf";
- ref<std::string> o = decompress(method, *compress(method, str));
+ auto o = decompress(method, compress(method, str));
- ASSERT_EQ(*o, str);
+ ASSERT_EQ(o, str);
}
TEST(decompress, decompressInvalidInputThrowsCompressionError) {
@@ -77,7 +77,7 @@ namespace nix {
(*sink)(inputString);
sink->finish();
- ASSERT_STREQ((*strSink.s).c_str(), inputString);
+ ASSERT_STREQ(strSink.s.c_str(), inputString);
}
TEST(makeCompressionSink, compressAndDecompress) {
@@ -90,7 +90,7 @@ namespace nix {
sink->finish();
decompressionSink->finish();
- ASSERT_STREQ((*strSink.s).c_str(), inputString);
+ ASSERT_STREQ(strSink.s.c_str(), inputString);
}
}