Rank, check and edit the plan at the paths the project's config names
This commit is contained in:
@@ -889,6 +889,7 @@ class TodoRankCheck(unittest.TestCase):
|
||||
pathlib.Path(checkout, "bin").mkdir()
|
||||
pathlib.Path(checkout, "bin", "rank_todo.py").write_text(stub)
|
||||
pathlib.Path(checkout, "todo.md").write_text("# todo\n")
|
||||
self.config = configured(self, pathlib.Path(checkout)) / "config.toml"
|
||||
return checkout
|
||||
|
||||
def details(self, checkout: str) -> list[str]:
|
||||
@@ -915,6 +916,30 @@ class TodoRankCheck(unittest.TestCase):
|
||||
self.assertTrue(reasons)
|
||||
self.assertNotIn("own script", " ".join(reasons))
|
||||
|
||||
def test_a_plan_the_config_puts_outside_the_checkout_is_checked_in_place_of_the_checkouts_todo_md(self):
|
||||
checkout = self.changed_plan(f"{self.folder}/clone", self.STUB)
|
||||
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))
|
||||
self.assertEqual(self.details(checkout), [], "the project has no plan yet, and the checkout's todo.md is its owners'")
|
||||
(self.config.parent / "todo.md").write_text("# todo\n")
|
||||
self.assertEqual(self.details(checkout), [f"own script checked {self.config.parent}/todo.md"])
|
||||
|
||||
def test_a_plan_in_a_folder_of_the_checkout_is_checked_once_it_changes(self):
|
||||
checkout = self.changed_plan(f"{self.folder}/clone", self.STUB)
|
||||
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"checkout:plan/todo.md"'))
|
||||
pathlib.Path(checkout, "plan").mkdir()
|
||||
pathlib.Path(checkout, "plan", "todo.md").write_text("# todo\n")
|
||||
self.assertEqual(self.details(checkout), [f"own script checked {checkout}/plan/todo.md"])
|
||||
git(checkout, "add", "plan")
|
||||
git(checkout, "commit", "-q", "-m", "plan")
|
||||
self.assertEqual(self.details(checkout), [], "committed, so unchanged")
|
||||
|
||||
def test_a_checkout_with_a_todo_md_and_no_config_is_told_to_write_one(self):
|
||||
checkout = self.changed_plan(self.other, self.STUB)
|
||||
self.config.unlink()
|
||||
self.assertEqual(self.details(checkout), [f"no config names the checkout {checkout}: write ~/.claude-projects/<key>/config.toml, as `project-config --help` shows"])
|
||||
pathlib.Path(checkout, "todo.md").unlink()
|
||||
self.assertEqual(self.details(checkout), [])
|
||||
|
||||
|
||||
class CommittedFiles(unittest.TestCase):
|
||||
"""A git commit holds the files it would commit to the file rules, as an Edit or Write of each would be."""
|
||||
|
||||
Reference in New Issue
Block a user