Skip to content

Commit

Permalink
Fixes failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tinganho committed Jun 22, 2017
1 parent e9566dd commit d5ef917
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
14 changes: 7 additions & 7 deletions src/Program/CommandParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,25 @@ Session* parse_command_args(int argc, char* argv[]) {
const Flag* flag_which_awaits_value = NULL;
vector<Flag> all_flags(default_flags);

auto add_command = [&](const char* arg) -> void {
auto add_command = [&](const char* command) -> void {
if (has_command) {
add_diagnostic(session, D::You_cannot_run_several_commands);
return;
}

for (auto const& command : commands) {
if (strcmp(command.name->c_str(), arg) == 0) {
session->command = command.kind;
if (command.flags != NULL) {
all_flags.insert(all_flags.end(), command.flags->begin(), command.flags->end());
for (auto const& c : commands) {
if (strcmp(c.name->c_str(), command) == 0) {
session->command = c.kind;
if (c.flags != NULL) {
all_flags.insert(all_flags.end(), c.flags->begin(), c.flags->end());
}
has_command = true;
return;
}
}

// We can only reach here if the command is unknown.
add_diagnostic(session, D::Unknown_command, arg);
add_diagnostic(session, D::Unknown_command, command);
};

auto add_command_flag = [&](const char* arg) -> bool {
Expand Down
1 change: 0 additions & 1 deletion src/Program/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ string read_file(string filename) {
while (getline(f, line)) {
result += line + '\n';
}
result = result.substr(0, result.length() - 1);
f.close();
return result;
}
Expand Down
18 changes: 9 additions & 9 deletions src/Tests/Current/Projects/Commands_DefaultHelp/Output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ Usage: l10ns [<options>] <command>

Commands:

init Initialize project.
sync Synchronize localization keys.
log Show latest added localizations.
set Set localization.
extension-run-testsRun extension tests.
extension-accept-baselinesAccept baselines.
init Initialize project.
sync Synchronize localization keys.
log Show latest added localizations.
set Set localization.
extension-run-tests Run extension tests.
extension-accept-baselines Accept baselines.

For more details: 'l10ns <command> --help'.

Options:

--help, -h Print help description.
--rootDir, -rd Specify current root dir(mainly for testing purposes).
--version Print current version.
--help, -h Print help description.
--rootDir, -rd Specify current root dir(mainly for testing purposes).
--version Print current version.
18 changes: 9 additions & 9 deletions src/Tests/Reference/Projects/Commands_DefaultHelp/Output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ Usage: l10ns [<options>] <command>

Commands:

init Initialize project.
sync Synchronize localization keys.
log Show latest added localizations.
set Set localization.
extension-run-testsRun extension tests.
extension-accept-baselinesAccept baselines.
init Initialize project.
sync Synchronize localization keys.
log Show latest added localizations.
set Set localization.
extension-run-tests Run extension tests.
extension-accept-baselines Accept baselines.

For more details: 'l10ns <command> --help'.

Options:

--help, -h Print help description.
--rootDir, -rd Specify current root dir(mainly for testing purposes).
--version Print current version.
--help, -h Print help description.
--rootDir, -rd Specify current root dir(mainly for testing purposes).
--version Print current version.

0 comments on commit d5ef917

Please sign in to comment.