Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/Rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,13 @@ void Rules::parse (const std::string& input, int nest /* = 1 */)
}
// Top-level settings:
// <name> '=' <value>
else if (tokens.size () >= 3 &&
std::get <0> (tokens[1]) == "=")
// <name> '='
else if (auto equals = line.find ('='); equals != std::string::npos)
{
// If this line is an assignment, then tokenizing it is a mistake, so use the raw data from 'line'.
auto equals = line.find ('=');
assert (equals != std::string::npos);

set (trim (line.substr (indent, equals - indent)),
trim (line.substr (equals + 1)));
}
// Top-level settings, with no value:
// <name> '='
else if (tokens.size () == 2 &&
std::get <0> (tokens[1]) == "=")
{
set (firstWord, "");
}
// Admit defeat.
else
{
Expand Down
8 changes: 8 additions & 0 deletions test/config.t
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ class TestConfig(TestCase):
code, out, err = self.t("config")
self.assertIn("month = ", out)

def test_set_tag_with_dashes_color(self):
"""Test setting tag color with dashes in tag name"""
self.t.config("tags.tag-with-dashes.color", "black on yellow")

code, out, err = self.t("config")
self.assertIn("tag-with-dashes", out)
self.assertIn("color = black on yellow", out)

def test_unset_known_hierarchical_name(self):
"""Test unsetting a known hierarchical name"""
code, out, err = self.t.runError("config reports.day.month :yes")
Expand Down
Loading