Skip to content

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

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
test/graph-query-and-parser-error-coverage-3301a6a399ecd85b
Draft

test: add coverage for graph queries and parser error paths (6 new tests)#38
github-actions[bot] wants to merge 1 commit intomainfrom
test/graph-query-and-parser-error-coverage-3301a6a399ecd85b

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

What gap was identified

Two areas with zero test coverage were identified:

  1. Graph query methodssrc/graph/queries.rs has methods find_action_invokers, find_usages, find_variable_writers, get_topic_reasoning_actions, and get_topic_action_defs with no tests at all. The existing query tests only covered find_outgoing_transitions, find_incoming_transitions, topic_execution_order, and stats.

  2. Parser error paths — none of the test files contained a test that expected parse_source to return Err. All existing tests verified successful parses, leaving the error-reporting code paths untested.

Files modified

  • src/graph/queries.rs — 5 new tests added to the existing #[cfg(test)] mod tests block
  • tests/integration_test.rs — 1 new test added to the existing mod parser_unit_tests block

New tests

Test What it covers
test_find_action_invokers_returns_invoking_reasoning_action A reasoning action targeting @actions.lookup creates an Invokes edge; find_action_invokers(lookup_def_idx) must return that reasoning action
test_get_topic_reasoning_actions_counts_correctly get_topic_reasoning_actions("topic_a") returns exactly the 1 reasoning action in that topic; returns empty for a leaf topic and for an unknown topic name
test_get_topic_action_defs_counts_correctly get_topic_action_defs("main") returns exactly 2 defs for a topic with two action definitions; returns empty for an unknown topic
test_find_variable_writers_after_set_clause A reasoning action with set @variables.step = 2 creates a Writes edge; find_variable_writers(step_idx) must include that reasoning action
test_find_usages_returns_all_incoming_edges_for_topic find_usages(topic_b) returns all incoming edges (not filtered by type), distinguishing it from find_incoming_transitions
test_parse_error_on_unknown_variable_type parse_source with an unrecognized type keyword (notavalidtype) must return Err — exercises the error-reporting path

Generated by Test Coverage Improver

…sts)

- test_find_action_invokers_returns_invoking_reasoning_action
- test_get_topic_reasoning_actions_counts_correctly
- test_get_topic_action_defs_counts_correctly
- test_find_variable_writers_after_set_clause
- test_find_usages_returns_all_incoming_edges_for_topic
- test_parse_error_on_unknown_variable_type

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