File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change 11import pathlib
2- import textwrap
32
43from click .testing import CliRunner
54
@@ -12,16 +11,27 @@ def test_format_cmd(tmp_path: pathlib.Path, cli_runner: CliRunner):
1211 beanhub_dir .mkdir ()
1312
1413 bean_file = beanhub_dir / "sample.bean"
15- bean_file .write_text (
16- textwrap .dedent (
17- """\
18- 2024-06-27 open Assets:Cash
19- """
20- )
21- )
14+ bean_file .write_text ("2024-06-27 open Assets:Cash" )
2215
2316 cli_runner .mix_stderr = False
2417 with switch_cwd (tmp_path ):
2518 result = cli_runner .invoke (cli , ["format" , str (bean_file )])
2619 assert result .exit_code == 0
2720 assert bean_file .read_text () == "2024-06-27 open Assets:Cash\n "
21+
22+
23+ def test_format_cmd_without_args (tmp_path : pathlib .Path , cli_runner : CliRunner ):
24+ beanhub_dir = tmp_path / ".beanhub"
25+ beanhub_dir .mkdir ()
26+
27+ included_bean = beanhub_dir / "mybook.bean"
28+ included_bean .write_text ("2024-06-27 open Assets:Cash" )
29+
30+ main_bean = beanhub_dir / "main.bean"
31+ main_bean .write_text ('include "mybook.bean"' )
32+
33+ cli_runner .mix_stderr = False
34+ with switch_cwd (beanhub_dir ):
35+ result = cli_runner .invoke (cli , ["format" ])
36+ assert result .exit_code == 0
37+ assert included_bean .read_text () == "2024-06-27 open Assets:Cash\n "
You can’t perform that action at this time.
0 commit comments