File src/sub_commands.cpp changed (mode: 100644) (index ef1fb1e..7c58cd0) |
... |
... |
private: |
708 |
708 |
const std::vector<std::string> &/*args*/) override |
const std::vector<std::string> &/*args*/) override |
709 |
709 |
{ |
{ |
710 |
710 |
std::string ref, refName; |
std::string ref, refName; |
711 |
|
if (!(std::cin >> ref)) { |
|
|
711 |
|
if (!std::getline(std::cin, ref)) { |
712 |
712 |
std::cerr << "Invalid input format: failed to read reference\n"; |
std::cerr << "Invalid input format: failed to read reference\n"; |
713 |
713 |
error(); |
error(); |
714 |
714 |
return; |
return; |
715 |
715 |
} |
} |
716 |
|
if (!(std::cin >> refName)) { |
|
|
716 |
|
if (!std::getline(std::cin, refName)) { |
717 |
717 |
std::cerr << "Invalid input format: failed to read reference " |
std::cerr << "Invalid input format: failed to read reference " |
718 |
718 |
"name\n"; |
"name\n"; |
719 |
719 |
error(); |
error(); |
File tests/sub_commands.cpp changed (mode: 100644) (index 73ca3ad..3699987) |
... |
... |
TEST_CASE("New creates new builds", "[subcommands][new-subcommand]") |
506 |
506 |
BuildHistory bh(db); |
BuildHistory bh(db); |
507 |
507 |
StreamCapture coutCapture(std::cout), cerrCapture(std::cerr); |
StreamCapture coutCapture(std::cout), cerrCapture(std::cerr); |
508 |
508 |
|
|
|
509 |
|
SECTION("Reference name can contain spaces") |
|
510 |
|
{ |
|
511 |
|
auto sizeWas = bh.getBuilds().size(); |
|
512 |
|
StreamSubstitute cinSubst(std::cin, |
|
513 |
|
"8e354da4df664b71e06c764feb29a20d64351a01\n" |
|
514 |
|
"WIP on master\n"); |
|
515 |
|
CHECK(getCmd("new")->exec(getSettings(), bh, repo, "new", |
|
516 |
|
{}) == EXIT_SUCCESS); |
|
517 |
|
REQUIRE(bh.getBuilds().size() == sizeWas + 1); |
|
518 |
|
REQUIRE(bh.getBuilds().back().getPaths() == vs({})); |
|
519 |
|
|
|
520 |
|
CHECK(cerrCapture.get() == std::string()); |
|
521 |
|
} |
|
522 |
|
|
509 |
523 |
SECTION("File missing from commit is just skipped") |
SECTION("File missing from commit is just skipped") |
510 |
524 |
{ |
{ |
511 |
525 |
auto sizeWas = bh.getBuilds().size(); |
auto sizeWas = bh.getBuilds().size(); |