aboutsummaryrefslogtreecommitdiff
path: root/paludis/dep_spec_TEST.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/dep_spec_TEST.cc')
-rw-r--r--paludis/dep_spec_TEST.cc72
1 files changed, 30 insertions, 42 deletions
diff --git a/paludis/dep_spec_TEST.cc b/paludis/dep_spec_TEST.cc
index 52d8c1224..816e054ad 100644
--- a/paludis/dep_spec_TEST.cc
+++ b/paludis/dep_spec_TEST.cc
@@ -19,62 +19,50 @@
#include <paludis/dep_spec.hh>
#include <paludis/user_dep_spec.hh>
+#include <paludis/version_requirements.hh>
+#include <paludis/environments/test/test_environment.hh>
+
#include <paludis/util/clone-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/options.hh>
-#include <paludis/version_requirements.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
+#include <paludis/util/stringify.hh>
+
+#include <gtest/gtest.h>
using namespace paludis;
-using namespace test;
-namespace test_cases
+TEST(FetchableURIDepSpec, Works)
{
- struct FetchableURIDepSpecTest : TestCase
- {
- FetchableURIDepSpecTest() : TestCase("fetchable uri dep spec") { }
-
- void run()
- {
- FetchableURIDepSpec a("foo");
- TEST_CHECK_EQUAL(a.original_url(), "foo");
- TEST_CHECK_EQUAL(a.renamed_url_suffix(), "");
- TEST_CHECK_EQUAL(a.filename(), "foo");
-
- FetchableURIDepSpec b("fnord -> bar");
- TEST_CHECK_EQUAL(b.original_url(), "fnord");
- TEST_CHECK_EQUAL(b.renamed_url_suffix(), "bar");
- TEST_CHECK_EQUAL(b.filename(), "bar");
+ FetchableURIDepSpec a("foo");
+ EXPECT_EQ("foo", a.original_url());
+ EXPECT_EQ("", a.renamed_url_suffix());
+ EXPECT_EQ("foo", a.filename());
- FetchableURIDepSpec c("http://example.com/download/baz");
- TEST_CHECK_EQUAL(c.filename(), "baz");
- }
- } test_fetchable_uri_dep_spec;
+ FetchableURIDepSpec b("fnord -> bar");
+ EXPECT_EQ("fnord", b.original_url());
+ EXPECT_EQ("bar", b.renamed_url_suffix());
+ EXPECT_EQ("bar", b.filename());
- struct DepSpecCloneTest : TestCase
- {
- DepSpecCloneTest() : TestCase("dep spec clone") { }
+ FetchableURIDepSpec c("http://example.com/download/baz");
+ EXPECT_EQ("baz", c.filename());
+}
- void run()
- {
- TestEnvironment env;
- PackageDepSpec a(parse_user_package_dep_spec("cat/pkg:1::repo[=1|>3.2][foo]",
- &env, { }));
+TEST(DepSpec, Clone)
+{
+ TestEnvironment env;
+ PackageDepSpec a(parse_user_package_dep_spec("cat/pkg:1::repo[=1|>3.2][foo]",
+ &env, { }));
- std::shared_ptr<PackageDepSpec> b(std::static_pointer_cast<PackageDepSpec>(a.clone()));
- TEST_CHECK_STRINGIFY_EQUAL(a, *b);
+ std::shared_ptr<PackageDepSpec> b(std::static_pointer_cast<PackageDepSpec>(a.clone()));
+ EXPECT_EQ(stringify(a), stringify(*b));
- std::shared_ptr<PackageDepSpec> c(std::static_pointer_cast<PackageDepSpec>(a.clone()));
- TEST_CHECK_STRINGIFY_EQUAL(a, *c);
+ std::shared_ptr<PackageDepSpec> c(std::static_pointer_cast<PackageDepSpec>(a.clone()));
+ EXPECT_EQ(stringify(a), stringify(*c));
- BlockDepSpec d("!" + stringify(*c), *c);
- std::shared_ptr<BlockDepSpec> e(std::static_pointer_cast<BlockDepSpec>(d.clone()));
- TEST_CHECK_STRINGIFY_EQUAL(d.blocking(), e->blocking());
- }
- } test_dep_spec_clone;
+ BlockDepSpec d("!" + stringify(*c), *c);
+ std::shared_ptr<BlockDepSpec> e(std::static_pointer_cast<BlockDepSpec>(d.clone()));
+ EXPECT_EQ(stringify(d.blocking()), stringify(e->blocking()));
}