From 723a15c5390d0c5eb42f2082fcedb7262e7bc856 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 22 Mar 2023 13:18:24 +0300 Subject: Add package_manifest::effective_type_sub_options() --- tests/manifest/driver.cxx | 18 +++++++++++++++++- tests/manifest/testscript | 20 +++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'tests/manifest') 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 +// argv[0] -et // 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 t (*argv[2] != '\0' ? argv[2] : optional ()); + 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 +} -- cgit v1.1