diff --git a/bin/release_plan/test_goals_file.py b/bin/release_plan/test_goals_file.py new file mode 100644 index 00000000..63ff4ff4 --- /dev/null +++ b/bin/release_plan/test_goals_file.py @@ -0,0 +1,17 @@ +import unittest + +from failure import Failure +from release_plan.goals_file import section + +GOALS_FILE = "# P\n## Goals\n1. g\n## Audience\nme\n" + + +class Section(unittest.TestCase): + def test_gives_the_text_under_the_one_heading(self): + self.assertEqual(section(GOALS_FILE, "Goals"), "1. g") + self.assertEqual(section(GOALS_FILE, "Audience"), "me") + + def test_says_what_the_goals_file_lacks(self): + self.assertEqual(section(GOALS_FILE, "Method"), Failure("has no ## Method heading")) + self.assertEqual(section(GOALS_FILE + "## Audience\nyou\n", "Audience"), Failure("has ## Audience more than once")) + self.assertEqual(section("## Goals\n\n## Audience\nme\n", "Goals"), Failure("has no text under ## Goals")) diff --git a/bin/rule_hook/test_rule_hook.py b/bin/rule_hook/test_rule_hook.py index a1239c69..55384b2d 100644 --- a/bin/rule_hook/test_rule_hook.py +++ b/bin/rule_hook/test_rule_hook.py @@ -111,6 +111,8 @@ class CommandBreaches(unittest.TestCase): def test_a_round_title_without_its_counts_breaks_round_title_counts(self): self.assertEqual(checked("git commit -m 'Answer stability round 1: fix the parser'"), ["round-title-counts"]) self.assertEqual(checked("git commit -m 'Answer stability round 1: 1 🔴, 2 🟡; fix the parser'"), ["round-title-counts"]) + command = "git commit -m 'Answer stability round 1: fix the parser'" + self.assertEqual(command_breaches(command, simple_commands(command, "/r", "/h"), "/h"), [Breach("round-title-counts", "open the summary after the round's colon with ` 🔴, 🟡 ( misread);`, where is at most + ", "/r")]) self.assertEqual(checked("git commit --allow-empty -m 'Answer prose round 2: 0 🔴, 0 🟡 (0 misread)'"), []) self.assertEqual(checked("git commit -m 'Answer stability round 1: 1 🔴, 2 🟡 (1 misread); fix the parser'"), []) self.assertEqual(checked("git commit -m 'Answer the question in the README'"), [])