Skip to content

Commit

Permalink
Merge branch 'reserve-colon-for-hints' into sruffell-active
Browse files Browse the repository at this point in the history
  • Loading branch information
sruffell committed Aug 14, 2020
2 parents c3c166d + 7b2fd1c commit 7ba8b97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/CLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,18 @@ void CLI::canonicalizeNames ()
}

// Hints.
else if (exactMatch ("hint", raw) ||
canonicalize (canonical, "hint", raw))
else if (0 == raw.compare (0, 1, ":"))
{
a.attribute ("canonical", canonical);
a.tag ("HINT");
if (exactMatch ("hint", raw) ||
canonicalize (canonical, "hint", raw))
{
a.attribute ("canonical", canonical);
a.tag ("HINT");
}
else
{
throw format ("'{1}' is an invalid hint.", raw);
}
}

// Extensions.
Expand Down
5 changes: 5 additions & 0 deletions test/cli.t
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ class TestCLI(TestCase):
code, out, err = self.t.runError("bogus")
self.assertIn("'bogus' is not a timew command. See 'timew help'.", err)

def test_TimeWarrior_with_invalid_hint(self):
"""Call a non-existing TimeWarrior hint should be an error"""
code, out, err = self.t.runError("start :invalid_hint")
self.assertIn("':invalid_hint'", err)


if __name__ == "__main__":
from simpletap import TAPTestRunner
Expand Down

0 comments on commit 7ba8b97

Please sign in to comment.