diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-01-29 22:34:05 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-01-30 15:47:34 +0300 |
commit | e47ed2a264364cace0519ee16f152fe882f2e6f8 (patch) | |
tree | df48b8f5427ea6031e6f08179b1cf876e44d10af /tests/standard-version/driver.cxx | |
parent | 2be71ce80a4352a78ae80d0c698b07f0da765f99 (diff) |
Add support for $ in standard version constraint
Diffstat (limited to 'tests/standard-version/driver.cxx')
-rw-r--r-- | tests/standard-version/driver.cxx | 23 |
1 files changed, 19 insertions, 4 deletions
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) <version> // argv[0] -cm <version> <version> -// argv[0] -cr +// argv[0] -cr [<dependent-version>] // argv[0] -sf <version> <constraint> // 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<standard_version> 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") { |