aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/libutil
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-05-03 22:23:02 +0200
committereldritch horrors <pennae@lix.systems>2024-06-19 10:50:12 +0000
commit67f778670c085615470b67eb3c54885b8c2d482e (patch)
tree414340cf5c91ff32286472206d71c588dd4ac260 /tests/unit/libutil
parent3425e90d76a311c6639b7c040f6a9e14856e18f4 (diff)
libutil: add makeDecompressionSource
Change-Id: Iac7f24d79e24417436b9b5cbefd6af051aeea0a6
Diffstat (limited to 'tests/unit/libutil')
-rw-r--r--tests/unit/libutil/compression.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/unit/libutil/compression.cc b/tests/unit/libutil/compression.cc
index bbbf3500f..0542e7d33 100644
--- a/tests/unit/libutil/compression.cc
+++ b/tests/unit/libutil/compression.cc
@@ -81,16 +81,17 @@ namespace nix {
}
TEST(makeCompressionSink, compressAndDecompress) {
- StringSink strSink;
auto inputString = "slfja;sljfklsa;jfklsjfkl;sdjfkl;sadjfkl;sdjf;lsdfjsadlf";
- auto decompressionSink = makeDecompressionSink("bzip2", strSink);
- auto sink = makeCompressionSink("bzip2", *decompressionSink);
+ StringSink strSink;
+ auto sink = makeCompressionSink("bzip2", strSink);
(*sink)(inputString);
sink->finish();
- decompressionSink->finish();
- ASSERT_STREQ(strSink.s.c_str(), inputString);
+ StringSource strSource{strSink.s};
+ auto decompressionSource = makeDecompressionSource("bzip2", strSource);
+
+ ASSERT_STREQ(decompressionSource->drain().c_str(), inputString);
}
}