From e47ed2a264364cace0519ee16f152fe882f2e6f8 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 29 Jan 2019 22:34:05 +0300 Subject: Add support for $ in standard version constraint --- tests/standard-version/driver.cxx | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'tests/standard-version/driver.cxx') diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx index 353cc24..72dbb4a 100644 --- a/tests/standard-version/driver.cxx +++ b/tests/standard-version/driver.cxx @@ -147,7 +147,7 @@ version (const string& s, // // argv[0] (-rl|-pr|-al|-bt|-st|-el|-sn|-fn) // argv[0] -cm -// argv[0] -cr +// argv[0] -cr [] // argv[0] -sf // argv[0] // @@ -161,7 +161,8 @@ version (const string& s, // -fn output 'y' for final, 'n' otherwise // // -cm output 0 if versions are equal, -1 if the first one is less, 1 otherwise -// -cr create version constraints from stdin lines, and print them to stdout +// -cr create version constraints from stdin lines, optionally using the +// dependent version, and print them to stdout // -sf output 'y' if version satisfies constraint, 'n' otherwise // // If no options are specified, then create versions from stdin lines, and @@ -241,11 +242,25 @@ try } else if (o == "-cr") { - assert (argc == 2); + assert (argc <= 3); + + optional dv; + if (argc == 3) + { + string s (argv[2]); + + dv = s.empty () + ? standard_version () + : standard_version (s, + standard_version::allow_stub | + standard_version::allow_earliest); + } string s; while (getline (cin, s)) - cout << standard_version_constraint (s) << endl; + cout << (dv + ? standard_version_constraint (s, *dv) + : standard_version_constraint (s)) << endl; } else if (o == "-sf") { -- cgit v1.1