aboutsummaryrefslogtreecommitdiff
path: root/tests/loader
diff options
context:
space:
mode:
Diffstat (limited to 'tests/loader')
-rw-r--r--tests/loader/driver.cxx79
-rw-r--r--tests/loader/external/1/basics/packages8
-rw-r--r--tests/loader/external/1/basics/repositories3
-rw-r--r--tests/loader/external/1/misc/repositories7
-rw-r--r--tests/loader/external/1/staging/packages8
-rw-r--r--tests/loader/external/1/staging/repositories3
-rw-r--r--tests/loader/external/1/testing/packages9
-rw-r--r--tests/loader/external/1/testing/repositories8
-rw-r--r--tests/loader/internal/1/stable/repositories6
9 files changed, 122 insertions, 9 deletions
diff --git a/tests/loader/driver.cxx b/tests/loader/driver.cxx
index f1e1385..74c6966 100644
--- a/tests/loader/driver.cxx
+++ b/tests/loader/driver.cxx
@@ -89,12 +89,14 @@ main (int argc, char* argv[])
session s;
transaction t (db.begin ());
- assert (db.query<repository> ().size () == 3);
- assert (db.query<package> ().size () == 10);
+ assert (db.query<repository> ().size () == 5);
+ assert (db.query<package> ().size () == 12);
shared_ptr<repository> sr (db.load<repository> ("cppget.org/stable"));
shared_ptr<repository> mr (db.load<repository> ("cppget.org/math"));
shared_ptr<repository> cr (db.load<repository> ("cppget.org/misc"));
+ shared_ptr<repository> tr (db.load<repository> ("cppget.org/testing"));
+ shared_ptr<repository> gr (db.load<repository> ("cppget.org/staging"));
// Verify 'stable' repository.
//
@@ -443,7 +445,8 @@ main (int argc, char* argv[])
assert (cr->packages_timestamp ==
file_mtime (dir_path (cr->local_path) / path ("packages")));
- assert (cr->repositories_timestamp == timestamp_nonexistent);
+ assert (cr->repositories_timestamp ==
+ file_mtime (dir_path (cr->local_path) / path ("repositories")));
assert (!cr->internal);
shared_ptr<package> bpv (
@@ -525,6 +528,76 @@ main (int argc, char* argv[])
assert (fpv6->dependencies.empty ());
assert (fpv6->requirements.empty ());
+ // Verify 'testing' repository.
+ //
+ assert (tr->location.canonical_name () == "cppget.org/testing");
+ assert (tr->location.string () ==
+ "http://pkg.cppget.org/external/1/testing");
+ assert (tr->display_name.empty ());
+
+ dir_path trp (cp.directory () / dir_path ("external/1/testing"));
+ assert (tr->local_path == trp.normalize ());
+
+ assert (tr->packages_timestamp ==
+ file_mtime (dir_path (tr->local_path) / path ("packages")));
+ assert (tr->repositories_timestamp ==
+ file_mtime (dir_path (tr->local_path) / path ("repositories")));
+ assert (!tr->internal);
+
+ shared_ptr<package> mpv (
+ db.load<package> (package_id ("libmisc", version ("1.1"))));
+ assert (check_location (mpv));
+
+ shared_ptr<package> tpv (
+ db.load<package> (package_id ("libexpat", version ("5.1"))));
+ assert (check_location (tpv));
+
+ // Verify libmisc package version.
+ //
+ // libmisc-1.1
+ //
+ assert (mpv->summary.empty ());
+ assert (mpv->tags.empty ());
+ assert (!mpv->description);
+ assert (mpv->url.empty ());
+ assert (!mpv->package_url);
+ assert (mpv->email.empty ());
+ assert (!mpv->package_email);
+
+ assert (mpv->internal_repository == nullptr);
+ assert (mpv->external_repositories.size () == 1);
+ assert (mpv->external_repositories[0].load () == tr);
+
+ assert (mpv->priority == priority ());
+ assert (mpv->changes.empty ());
+
+ assert (mpv->license_alternatives.empty ());
+ assert (mpv->dependencies.empty ());
+ assert (mpv->requirements.empty ());
+
+ // Verify libexpat package version.
+ //
+ // libexpat-5.1
+ //
+ assert (tpv->summary.empty ());
+ assert (tpv->tags.empty ());
+ assert (!tpv->description);
+ assert (tpv->url.empty ());
+ assert (!tpv->package_url);
+ assert (tpv->email.empty ());
+ assert (!tpv->package_email);
+
+ assert (tpv->internal_repository == nullptr);
+ assert (tpv->external_repositories.size () == 1);
+ assert (tpv->external_repositories[0].load () == gr);
+
+ assert (tpv->priority == priority ());
+ assert (tpv->changes.empty ());
+
+ assert (tpv->license_alternatives.empty ());
+ assert (tpv->dependencies.empty ());
+ assert (tpv->requirements.empty ());
+
// Change package summary, update the object persistent state, rerun
// loader and ensure the model were not rebuilt.
//
diff --git a/tests/loader/external/1/basics/packages b/tests/loader/external/1/basics/packages
new file mode 100644
index 0000000..86c20c1
--- /dev/null
+++ b/tests/loader/external/1/basics/packages
@@ -0,0 +1,8 @@
+: 1
+name: libexpat
+version: 5.1
+summary: The Expat Library
+license: MIT
+url: http://www.example.com/expat/
+email: expat-users@example.com
+location: libexpat-5.1.tar.gz
diff --git a/tests/loader/external/1/basics/repositories b/tests/loader/external/1/basics/repositories
new file mode 100644
index 0000000..9a15f2b
--- /dev/null
+++ b/tests/loader/external/1/basics/repositories
@@ -0,0 +1,3 @@
+: 1
+# Local repository manifest (this repository).
+#
diff --git a/tests/loader/external/1/misc/repositories b/tests/loader/external/1/misc/repositories
index 5128606..93acdb3 100644
--- a/tests/loader/external/1/misc/repositories
+++ b/tests/loader/external/1/misc/repositories
@@ -1,11 +1,12 @@
: 1
# Foreign repository manifest.
#
-location: http://pkg.example.org/1/misc
+location: ../basics
:
-# Foreign repository manifest.
+# Adjacent repository manifest.
#
-location: http://pkg.example.org/1/math
+location: ../testing
+role: complement
:
# Local repository manifest (this repository).
#
diff --git a/tests/loader/external/1/staging/packages b/tests/loader/external/1/staging/packages
new file mode 100644
index 0000000..86c20c1
--- /dev/null
+++ b/tests/loader/external/1/staging/packages
@@ -0,0 +1,8 @@
+: 1
+name: libexpat
+version: 5.1
+summary: The Expat Library
+license: MIT
+url: http://www.example.com/expat/
+email: expat-users@example.com
+location: libexpat-5.1.tar.gz
diff --git a/tests/loader/external/1/staging/repositories b/tests/loader/external/1/staging/repositories
new file mode 100644
index 0000000..9a15f2b
--- /dev/null
+++ b/tests/loader/external/1/staging/repositories
@@ -0,0 +1,3 @@
+: 1
+# Local repository manifest (this repository).
+#
diff --git a/tests/loader/external/1/testing/packages b/tests/loader/external/1/testing/packages
new file mode 100644
index 0000000..ac5ab95
--- /dev/null
+++ b/tests/loader/external/1/testing/packages
@@ -0,0 +1,9 @@
+: 1
+name: libmisc
+version: 1.1
+summary: The Expat Library
+license: MIT
+url: http://www.example.com/misc/
+email: misc-users@example.com
+depends: libexpat >= 5.0
+location: libmisc-1.1.tar.gz
diff --git a/tests/loader/external/1/testing/repositories b/tests/loader/external/1/testing/repositories
new file mode 100644
index 0000000..5f7246c
--- /dev/null
+++ b/tests/loader/external/1/testing/repositories
@@ -0,0 +1,8 @@
+: 1
+# Adjacent repository manifest.
+#
+location: ../staging
+role: complement
+:
+# Local repository manifest (this repository).
+#
diff --git a/tests/loader/internal/1/stable/repositories b/tests/loader/internal/1/stable/repositories
index 4c12e72..38fdd72 100644
--- a/tests/loader/internal/1/stable/repositories
+++ b/tests/loader/internal/1/stable/repositories
@@ -1,11 +1,11 @@
: 1
# Foreign repository manifest.
#
-location: http://pkg.cppget.org/1/math
+location: ../../../external/1/misc
:
-# Foreign repository manifest.
+# Adjacent repository manifest.
#
-location: ../../../external/1/misc
+location: ../math
:
# Local repository manifest (this repository).
#