@@ -376,6 +376,56 @@ def test_acceptance_tests_block_include_with_trailing_newline_keeps_structure_an
376376 plain_file .plain_file_parser ("block_level_include.plain" , [get_test_data_path ("data/templates" )])
377377
378378
379+ def test_acceptance_tests_top_level_rejected ():
380+ plain_source = """
381+ ***acceptance tests***
382+
383+ - Test something.
384+ """
385+ with pytest .raises (
386+ PlainSyntaxError ,
387+ match = re .escape (
388+ "Syntax error at line 1: acceptance tests heading should be nested under specific functional spec."
389+ ),
390+ ):
391+ plain_file .parse_plain_source (plain_source , {}, [], [], [])
392+
393+
394+ def test_acceptance_tests_top_level_after_other_headings_rejected ():
395+ plain_source = """***definitions***
396+
397+ - :concept: is a concept.
398+
399+ ***acceptance tests***
400+
401+ - Test something.
402+ """
403+ with pytest .raises (
404+ PlainSyntaxError ,
405+ match = re .escape (
406+ "Syntax error at line 5: acceptance tests heading should be nested under specific functional spec."
407+ ),
408+ ):
409+ plain_file .parse_plain_source (plain_source , {}, [], [], [])
410+
411+
412+ def test_acceptance_tests_nested_under_functional_spec_allowed ():
413+ plain_source = """***definitions***
414+
415+ - :concept: is a concept.
416+
417+ ***functional specs***
418+
419+ - Display "hello, world"
420+
421+ ***acceptance tests***
422+
423+ - Test the :concept:.
424+ """
425+ result = plain_file .parse_plain_source (plain_source , {}, [], [], [])
426+ assert plain_spec .FUNCTIONAL_REQUIREMENTS in result .plain_source
427+
428+
379429def test_concept_validation_definitions (get_test_data_path ):
380430 plain_file .plain_file_parser (
381431 "concept_validation_definition.plain" ,
0 commit comments