reapack

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

commit 4d81364926c37a4d17c25928b31505d86079bc6c
parent f90d1c6a1e8b2b546440a59337a68e3b9338994c
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Sun, 14 Feb 2016 00:18:47 -0500

silently discard unsupported packages (again)

Diffstat:
Msrc/package.cpp | 7++++++-
Mtest/index_v1.cpp | 6++++++
Atest/indexes/v1/ReaPack/unsupported_type.xml | 9+++++++++
Mtest/package.cpp | 8+-------
4 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/package.cpp b/src/package.cpp @@ -95,7 +95,12 @@ Path Package::makeTargetPath(const string &file) const path += Path(m_category->name()) + file; break; default: - throw reapack_error("unsupported package type"); + // The package has an unsupported type, so we return an empty path. + // The empty path won't be used because the category will reject + // this package right away. Maybe the parser should not bother with loading + // unsupported packages at all anyway... But then in the future + // we might want to display unsupported packages in the interface. + break; } return path; diff --git a/test/index_v1.cpp b/test/index_v1.cpp @@ -69,6 +69,12 @@ TEST_CASE("null package type", M) { } } +TEST_CASE("unsupported package type", M) { + UseRootPath root(RIPATH); + + const RemoteIndex *ri = RemoteIndex::load("unsupported_type"); +} + TEST_CASE("read version author", M) { UseRootPath root(RIPATH); diff --git a/test/indexes/v1/ReaPack/unsupported_type.xml b/test/indexes/v1/ReaPack/unsupported_type.xml @@ -0,0 +1,9 @@ +<index version="1"> + <category name="test"> + <reapack name="a" type="hello_world"> + <version name="1.0"> + <source>http://google.com</source> + </version> + </reapack> + </category> +</index> diff --git a/test/package.cpp b/test/package.cpp @@ -87,13 +87,7 @@ TEST_CASE("target path for unknown package type", M) { Package pack(Package::UnknownType, "a", &cat); - try { - pack.makeTargetPath({}); - FAIL(); - } - catch(const reapack_error &e) { - REQUIRE(string(e.what()) == "unsupported package type"); - } + REQUIRE(pack.makeTargetPath({}).empty()); } TEST_CASE("script target path", M) {