forked from HAL9000/cleveragents-core
85 lines
3.0 KiB
Gherkin
85 lines
3.0 KiB
Gherkin
Feature: YAML Template Engine Specific Coverage
|
|
As a developer using CleverAgents
|
|
I want to test specific missing coverage lines
|
|
So that I can achieve 90%+ coverage
|
|
|
|
Background:
|
|
Given the YAML template engine is initialized
|
|
|
|
Scenario: Load file method coverage
|
|
Given I have a test YAML file "simple.yaml" with plain content:
|
|
"""
|
|
name: TestConfig
|
|
version: 1.0
|
|
"""
|
|
When I load the file using load_file method
|
|
Then the file should be read and parsed correctly
|
|
And the result should contain name "TestConfig"
|
|
|
|
Scenario: Load string without templates coverage
|
|
Given I have a YAML string with no template markers:
|
|
"""
|
|
config:
|
|
name: PlainProject
|
|
version: 2.0
|
|
settings:
|
|
debug: false
|
|
"""
|
|
When I load the string using load_string method
|
|
Then it should use direct YAML parsing without templates
|
|
And the result should be a valid dictionary
|
|
And should contain config name "PlainProject" in specific test
|
|
|
|
Scenario: Multiple file loading scenarios
|
|
Given I have multiple test files to exercise file loading:
|
|
| filename | content_type |
|
|
| config1.yaml | plain |
|
|
| config2.yaml | with_vars |
|
|
When I load each file with appropriate context
|
|
Then all files should be processed correctly
|
|
And both plain and template files should work
|
|
|
|
Scenario: Template engine all filters
|
|
Given I have YAML that exercises all custom filters:
|
|
"""
|
|
filter_tests:
|
|
yaml_output: {{ data | yaml }}
|
|
indented_text: "{{ text | indent(2) }}"
|
|
sum_basic: {{ numbers | sum }}
|
|
sum_with_attr: {{ items | sum(attribute='count') }}
|
|
selectattr_test: {{ objects | selectattr('active', '==', true) | list | length }}
|
|
"""
|
|
And I have comprehensive filter context
|
|
When I process with all filters
|
|
Then all custom filters should execute successfully
|
|
And yaml filter should produce YAML strings
|
|
And indent filter should add spaces
|
|
And sum filters should calculate correctly
|
|
And selectattr should filter objects
|
|
|
|
Scenario: Error path coverage
|
|
Given I have problematic YAML content that will trigger error paths:
|
|
"""
|
|
problematic:
|
|
{% for item in items %}
|
|
key1: value1 key2: value2
|
|
{% endfor %}
|
|
"""
|
|
And I have context that causes YAML errors:
|
|
| key | value |
|
|
| items | [a, b, c] |
|
|
When I process the problematic YAML for specific coverage
|
|
Then the YAML error handling should be triggered
|
|
And fallback processing should occur
|
|
|
|
Scenario: Template reconstruction coverage
|
|
Given I have template data for reconstruction testing
|
|
When I test the reconstruction methods directly
|
|
Then the reconstruction should handle various cases
|
|
And nested structures should be reconstructed properly
|
|
|
|
Scenario: Direct method testing for coverage
|
|
Given I have the YAML template engine
|
|
When I call private methods for testing coverage
|
|
Then missing lines should be executed
|
|
And all code paths should be covered |