@@ -239,6 +239,46 @@ def test_wavedrom_dump_json(tmp_path: Path, simple_regmap: csr.Map) -> None:
239239 assert {f for f in expected_data_dir .iterdir () if f .suffix == ".json" } == expected_json_files
240240
241241
242+ def test_autogenerated_comment_present (tmp_path : Path , simple_regmap : csr .Map ) -> None :
243+ """Test that the autogenerated comment is present in the output file."""
244+ config = csr .MarkdownGenerator .Config ()
245+ gen = csr .MarkdownGenerator (
246+ label = "test_md_gen_autogen_comment" , register_map = simple_regmap , config = config , output_dir = tmp_path
247+ )
248+ generated_files = list (gen ())
249+
250+ assert len (generated_files ) == 1
251+ output_file = generated_files [0 ]
252+ assert output_file .is_file ()
253+
254+ content = output_file .read_text ()
255+ assert "[//]: # (DO NOT EDIT THIS AUTOGENERATED FILE. ALL CHANGES WILL BE LOST.)" in content
256+
257+
258+ def test_print_disclaimer_true (tmp_path : Path , simple_regmap : csr .Map ) -> None :
259+ """Test that disclaimer is printed when print_disclaimer is True."""
260+ config = csr .MarkdownGenerator .Config (print_disclaimer = True )
261+ gen = csr .MarkdownGenerator (
262+ label = "test_md_gen_disclaimer_true" , register_map = simple_regmap , config = config , output_dir = tmp_path
263+ )
264+ generated_files = list (gen ())
265+ output_file = generated_files [0 ]
266+ content = output_file .read_text ()
267+ assert "Generated by [Corsair]" in content
268+
269+
270+ def test_print_disclaimer_false (tmp_path : Path , simple_regmap : csr .Map ) -> None :
271+ """Test that disclaimer is not printed when print_disclaimer is False."""
272+ config = csr .MarkdownGenerator .Config (print_disclaimer = False )
273+ gen = csr .MarkdownGenerator (
274+ label = "test_md_gen_disclaimer_false" , register_map = simple_regmap , config = config , output_dir = tmp_path
275+ )
276+ generated_files = list (gen ())
277+ output_file = generated_files [0 ]
278+ content = output_file .read_text ()
279+ assert "Generated by [Corsair]" not in content
280+
281+
242282def test_custom_template_and_extra_param (tmp_path : Path , simple_regmap : csr .Map , custom_template : Path ) -> None :
243283 """Test generation with a custom template and extra config parameters."""
244284 template_file = custom_template
0 commit comments