aboutsummaryrefslogtreecommitdiff
path: root/tests/manifest
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-03-22 13:18:24 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-03-23 18:32:37 +0300
commit723a15c5390d0c5eb42f2082fcedb7262e7bc856 (patch)
tree7bef948322e2de710f44943e1e0dd621dc9b0d86 /tests/manifest
parentc97dba3a4f2af33091112a347e181a5a2edc9914 (diff)
Add package_manifest::effective_type_sub_options()
Diffstat (limited to 'tests/manifest')
-rw-r--r--tests/manifest/driver.cxx18
-rw-r--r--tests/manifest/testscript20
2 files changed, 36 insertions, 2 deletions
diff --git a/tests/manifest/driver.cxx b/tests/manifest/driver.cxx
index fb40f7e..bf97c42 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) [-l]
// argv[0] -p [-c] [-i] [-l]
// argv[0] -ec <version>
+// argv[0] -et <type> <name>
// argv[0] -v
//
// In the first form read and parse manifest list from stdin and serialize it
@@ -52,7 +53,10 @@ 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.
+// In the forth form print the effective type and the type sub-options to
+// stdout (one per line) and exit.
+//
+// In the fifth form print the libbpkg version to stdout and exit.
//
int
main (int argc, char* argv[])
@@ -135,6 +139,18 @@ main (int argc, char* argv[])
cout << c << " " << ec << endl;
}
}
+ else if (mode == "-et")
+ {
+ assert (argc == 4);
+
+ optional<string> t (*argv[2] != '\0' ? argv[2] : optional<string> ());
+ package_name n (argv[3]);
+
+ cout << package_manifest::effective_type (t, n) << endl;
+
+ for (const string& so: package_manifest::effective_type_sub_options (t))
+ cout << so << endl;
+ }
else
{
bool long_lines (false);
diff --git a/tests/manifest/testscript b/tests/manifest/testscript
index 6f714ad..222d262 100644
--- a/tests/manifest/testscript
+++ b/tests/manifest/testscript
@@ -129,7 +129,7 @@
: 1
name: foo
version: 2.0.0
- type: bash
+ type: bash, something extra
summary: Modern C++ parser
license: LGPLv2
EOO
@@ -4757,3 +4757,21 @@
}
}
}
+
+: effective-type
+:
+{
+ test.options += -et
+
+ $* '' libfoo >'lib' : lib-prefix
+ $* '' foo >'exe' : no-lib-prefix
+ $* 'mixed' foo >'other' : other
+
+ : lib-binless
+ :
+ $* 'lib,binless,extras' libfoo >>EOO
+ lib
+ binless
+ extras
+ EOO
+}