Files
temp/tests/features/yaml_template_engine_targeted_coverage.feature
T

147 lines
4.5 KiB
Gherkin

Feature: YAML Template Engine Targeted Coverage
As a developer using CleverAgents
I want to hit specific uncovered code paths in YAMLTemplateEngine
So that coverage reaches 90%+
Background:
Given the YAML template engine is initialized
@targeted_coverage
Scenario: Test postprocessing line splitting with specific pattern
Given I have YAML with specific line splitting pattern:
"""
config:
combined: value1 key2: value2
test: normal value
"""
When I process postprocessing line splitting
Then specific line splitting should occur
And the lines should be restructured
@targeted_coverage
Scenario: Test extraction with complex template structure analysis
Given I have complex YAML for template extraction:
"""
root:
{% for item in items %}
{{ item.name }}:
value: {{ item.value }}
nested:
{% if item.enabled %}
feature: active
{% endif %}
{% endfor %}
"""
When I trigger template structure extraction
Then complex extraction should be attempted
And template blocks should be processed
@targeted_coverage
Scenario: Test template rendering without raw template
Given I have a template config without raw template:
"""
{
"config": {
"_template_content": "name: {{ name }}\nvalue: {{ value }}",
"_template_type": "block"
}
}
"""
And I have render context:
| key | value |
| name | test_name |
| value | test_value |
When I render the template without raw format
Then the template should be reconstructed and rendered
And the result should contain substituted values
@targeted_coverage
Scenario: Test sum filter with first item as dict
Given I have sum filter data with first item as dict:
"""
[{"value": 10}, {"value": 20}, {"value": 30}]
"""
When I test sum filter with dict items
Then sum filter should handle dict items correctly
And should sum the value attributes
@targeted_coverage
Scenario: Test selectattr with object attribute access
Given I have objects with object attributes:
"""
[{"name": "obj1", "data": {"score": 85}}, {"name": "obj2", "data": {"score": 45}}]
"""
When I test selectattr with object attribute access
Then selectattr should access object attributes
And should filter based on object attributes
@targeted_coverage
Scenario: Test YAML structure analysis with comments and empty lines
Given I have YAML with mixed content for structure analysis:
"""
# This is a comment
root:
# Another comment
{% for item in items %}
{{ item.name }}:
value: {{ item.value }}
{% endfor %}
# Final comment
static: value
"""
When I analyze the structure with comments
Then comments should be skipped in analysis
And empty lines should be ignored
And template blocks should be found
@targeted_coverage
Scenario: Test block end finding at file end
Given I have YAML with block at end:
"""
section:
{% for item in items %}
{{ item }}: value
"""
When I find block end at file boundary
Then block end should be found correctly
And should handle end of file properly
@targeted_coverage
Scenario: Test template extraction with parent key finding
Given I have YAML requiring parent key extraction:
"""
parent_section:
{% for item in items %}
item_{{ item }}: value
{% endfor %}
"""
When I extract templates with parent key detection
Then parent key should be found correctly
And template sections should be marked properly
@targeted_coverage
Scenario: Test reconstruction with various value types
Given I have template structure with mixed value types:
"""
{
"root": {
"null_value": null,
"empty_dict": {},
"nested": {
"inner": "value"
},
"list_data": ["item1", "item2"],
"template_block": {
"_template_content": "{{ template_var }}",
"_template_type": "block"
}
}
}
"""
When I reconstruct from mixed value structure
Then null values should be handled in reconstruction
And nested structures should be processed
And list data should be formatted correctly
And template blocks should be restored properly