Skip to content

test: add coverage for parser error paths and graph queries (7 new tests)#40

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
test/parser-error-paths-and-graph-queries-8bf70b1d3190340a
Draft

test: add coverage for parser error paths and graph queries (7 new tests)#40
github-actions[bot] wants to merge 1 commit intomainfrom
test/parser-error-paths-and-graph-queries-8bf70b1d3190340a

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Gap identified

Two areas had zero test coverage:

  1. Parser error paths — no existing test ever asserts that parse() returns Err. All tests only cover valid input. The validator in variables.rs explicitly emits errors for = None on non-boolean types, and the config parser rejects non-string values, but neither was exercised.

  2. Graph query functionsfind_action_invokers, find_variable_readers, and find_variable_writers in src/graph/queries.rs had no unit tests, despite being public API used by graph analysis features.

Files modified

File Change
tests/test_parser_errors.rs New integration test file (5 tests)
src/graph/queries.rs 2 new tests in existing #[cfg(test)] mod tests block
Cargo.toml Added [[test]] entry for test_parser_errors

New tests

tests/test_parser_errors.rs

Test What it covers
test_none_default_for_string_variable_is_rejected Validator in variables.rs rejects = None for mutable string
test_none_default_for_integer_variable_is_rejected Same validator rejects = None for mutable integer
test_none_default_for_boolean_variable_is_valid Confirms the validator allows = None for mutable boolean (valid case)
test_config_field_value_must_be_a_string_literal Config parser rejects a bare number (42) where a string literal is required
test_empty_file_parses_to_default_agent Empty input is syntactically valid, producing an AgentFile with all fields absent

src/graph/queries.rs

Test What it covers
test_find_action_invokers_returns_correct_node A reasoning action pointing to @actions.get_status creates a RefEdge::Invokes edge; find_action_invokers(action_def) returns that reasoning action
test_find_variable_writers_from_set_clause A set @variables.x = @outputs.y clause creates a RefEdge::Writes edge; find_variable_writers(var) returns the reasoning action that writes it

Generated by Test Coverage Improver

…sts)

Add tests for two previously uncovered areas:

1. Parser error paths (tests/test_parser_errors.rs, new file):
   - test_none_default_for_string_variable_is_rejected
   - test_none_default_for_integer_variable_is_rejected
   - test_none_default_for_boolean_variable_is_valid
   - test_config_field_value_must_be_a_string_literal
   - test_empty_file_parses_to_default_agent

2. Graph query functions (src/graph/queries.rs):
   - test_find_action_invokers_returns_correct_node
   - test_find_variable_writers_from_set_clause

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants