diff --git a/src/Rules.cpp b/src/Rules.cpp index 6be6a3c1..a815fcf6 100644 --- a/src/Rules.cpp +++ b/src/Rules.cpp @@ -372,23 +372,13 @@ void Rules::parse (const std::string& input, int nest /* = 1 */) } // Top-level settings: // '=' - else if (tokens.size () >= 3 && - std::get <0> (tokens[1]) == "=") + // '=' + 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: - // '=' - else if (tokens.size () == 2 && - std::get <0> (tokens[1]) == "=") - { - set (firstWord, ""); - } // Admit defeat. else { diff --git a/test/config.t b/test/config.t index e4164cf8..4dd54506 100755 --- a/test/config.t +++ b/test/config.t @@ -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")