aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/manifest/driver.cxx10
-rw-r--r--tests/manifest/testscript143
2 files changed, 153 insertions, 0 deletions
diff --git a/tests/manifest/driver.cxx b/tests/manifest/driver.cxx
index 44b1a79..273dce5 100644
--- a/tests/manifest/driver.cxx
+++ b/tests/manifest/driver.cxx
@@ -23,6 +23,7 @@ using namespace bpkg;
// argv[0] (-pp|-dp|-gp|-pr|-dr|-gr|-s)
// argv[0] -p -c -i
// argv[0] -ec <version>
+// argv[0] -v
//
// In the first form read and parse manifest list from stdin and serialize it
// to stdout. The following options specify the manifest type.
@@ -34,6 +35,7 @@ using namespace bpkg;
// -dr parse dir repository manifest list
// -gr parse git repository manifest list
// -s parse signature manifest
+// -v print the libbpkg version
//
// In the second form read and parse the package manifest from stdin and
// serialize it to stdout.
@@ -47,6 +49,8 @@ using namespace bpkg;
// roundtrip them to stdout together with their effective constraints,
// calculated using version passed as an argument.
//
+// In the forth form print the libbpkg version to stdout and exit.
+//
int
main (int argc, char* argv[])
{
@@ -55,6 +59,12 @@ main (int argc, char* argv[])
cout.exceptions (ios_base::failbit | ios_base::badbit);
+ if (mode == "-v")
+ {
+ cout << standard_version (LIBBPKG_VERSION_STR) << endl;
+ return 0;
+ }
+
manifest_parser p (cin, "stdin");
manifest_serializer s (cout, "stdout");
diff --git a/tests/manifest/testscript b/tests/manifest/testscript
index 25e0ae3..c35f618 100644
--- a/tests/manifest/testscript
+++ b/tests/manifest/testscript
@@ -935,6 +935,149 @@
: repository-list
:
{
+ : header
+ :
+ {
+ +$* -v | set v
+
+ test.options += -pr
+
+ : version
+ :
+ {
+ $* <<"EOF" >>"EOF"
+ : 1
+ min-bpkg-version: $v
+ :
+ location: http://pkg.example.org/1/math
+ type: pkg
+ role: prerequisite
+ :
+ url: http://cppget.org
+ email: repoman@cppget.org; General mailing list.
+ EOF
+ }
+
+ : invalid-version
+ :
+ {
+ $* <<EOI 2>'stdin:2:19: error: invalid minimum bpkg version: invalid major version' != 0
+ : 1
+ min-bpkg-version: foo
+ EOI
+ }
+
+ : too-new
+ :
+ {
+ $* <<EOI 2>'stdin:2:19: error: incompatible repositories manifest: minimum bpkg version is 1000.0.0' != 0
+ : 1
+ min-bpkg-version: 1000.0.0
+ EOI
+ }
+
+ : non-version
+ :
+ {
+ $* <<EOF >>EOF
+ : 1
+ compression: none
+ :
+ location: http://pkg.example.org/1/math
+ type: pkg
+ role: prerequisite
+ :
+ url: http://cppget.org
+ email: repoman@cppget.org; General mailing list.
+ EOF
+ }
+
+ : version-non-first
+ :
+ {
+ $* <<"EOI" 2>"stdin:3:1: error: minimum bpkg version must be first in repositories manifest header" != 0
+ : 1
+ compression: none
+ min-bpkg-version: $v
+ EOI
+ }
+
+ : unknown-header-value
+ :
+ {
+ $* <<EOI 2>"stdin:3:1: error: unknown name 'unknown' in repositories manifest header" != 0
+ : 1
+ compression: none
+ unknown: foo
+ EOI
+ }
+
+ : unknown-manifest-value
+ :
+ {
+ $* <<EOI 2>"stdin:2:1: error: unknown name 'unknown' in repository manifest" != 0
+ : 1
+ unknown: foo
+ EOI
+ }
+
+ : empty-repository-manifest
+ :
+ {
+ $* <<EOF >>EOF
+ : 1
+ compression: none
+ :
+ EOF
+ }
+
+ : base-redefinition
+ :
+ {
+ $* <<EOI 2>'stdin:4:1: error: base repository manifest redefinition' != 0
+ : 1
+ compression: none
+ :
+ :
+ EOI
+ }
+
+ : empty-base
+ :
+ {
+ $* <<"EOF" >>"EOF"
+ : 1
+ compression: none
+ :
+ location: http://pkg.example.org/1/math
+ type: pkg
+ role: prerequisite
+ :
+ EOF
+ }
+
+ : no-repository-manifest
+ :
+ {
+ $* <<EOF >>EOF
+ : 1
+ compression: none
+ EOF
+ }
+
+ : only-empty-base
+ :
+ {
+ $* <<EOF >>EOF
+ : 1
+ EOF
+ }
+
+ : empty-manifest-list
+ :
+ $* <'' 2>'stdin:2:1: error: start of repository manifest expected' != 0
+ }
+
: pkg
:
{