diff options
Diffstat (limited to 'tests/overrides/driver.cxx')
-rw-r--r-- | tests/overrides/driver.cxx | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/overrides/driver.cxx b/tests/overrides/driver.cxx index 4302bb1..c4a09ef 100644 --- a/tests/overrides/driver.cxx +++ b/tests/overrides/driver.cxx @@ -6,15 +6,17 @@ #include <vector> #include <cstddef> // size_t #include <cstdint> // uint64_t -#include <cassert> #include <iostream> -#include <libbutl/utility.mxx> // trim() -#include <libbutl/manifest-parser.mxx> -#include <libbutl/manifest-serializer.mxx> +#include <libbutl/utility.hxx> // trim() +#include <libbutl/manifest-parser.hxx> +#include <libbutl/manifest-serializer.hxx> #include <libbpkg/manifest.hxx> +#undef NDEBUG +#include <cassert> + using namespace std; using namespace butl; using namespace bpkg; @@ -31,7 +33,7 @@ main (int argc, char* argv[]) { vector<manifest_name_value> overrides; - bool name (false); + string name; uint64_t l (1); for (int i (1); i != argc; ++i) @@ -40,7 +42,7 @@ main (int argc, char* argv[]) if (a == "-n") { - name = true; + name = "args"; } else { @@ -76,7 +78,19 @@ main (int argc, char* argv[]) try { package_manifest m (p); - m.override (overrides, name ? "args" : string ()); + m.override (overrides, name); + + // While at it, test validate_overrides(). + // + try + { + package_manifest::validate_overrides (overrides, name); + } + catch (const manifest_parsing&) + { + assert (false); // Validation must never fail if override succeeds. + } + m.serialize (s); } catch (const manifest_parsing& e) |