reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit f583fe2e40bbb9a68b8d6bb2b06a76a9aba46eb7
parent 676bed49555fb32f87aae6b5e4f13633a7beda56
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu, 14 Sep 2017 00:26:31 -0400

receipt: don't insert trailing newline

It's ugly on Windows.

Diffstat:
Msrc/receipt.hpp | 8++++++--
Mtest/receipt.cpp | 7++++++-
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/receipt.hpp b/src/receipt.hpp @@ -72,8 +72,12 @@ public: std::ostringstream stream; - for(const auto &item : list) - stream << item << "\r\n"; + for(const auto &item : list) { + if(stream.tellp() > 0) + stream << "\r\n"; + + stream << item; + } m_contents = stream.str(); } diff --git a/test/receipt.cpp b/test/receipt.cpp @@ -79,6 +79,11 @@ TEST_CASE("format receipt page title", M) { } } +TEST_CASE("format receipt page contents", M) { + ReceiptPage page{vector<int>{1, 2, 3}, "", ""}; + REQUIRE(page.contents() == "1\r\n2\r\n3"); +} + TEST_CASE("format install ticket", M) { IndexPtr ri = make_shared<Index>("Index Name"); Category cat("Category Name", ri.get()); @@ -158,6 +163,6 @@ TEST_CASE("sort InstallTickets (case insensitive)", M) { REQUIRE(page.find(pkg1.name()) < page.find(pkg2.name())); REQUIRE(page.find(pkg2.name()) < page.find(pkg3.name())); - // duplicate should be preserved + // duplicates should still be preserved REQUIRE(page.find(pkg1.name()) < page.rfind(pkg1.name())); }