test: add coverage for parser error paths and graph queries (7 new tests)#40
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gap identified
Two areas had zero test coverage:
Parser error paths — no existing test ever asserts that
parse()returnsErr. All tests only cover valid input. The validator invariables.rsexplicitly emits errors for= Noneon non-boolean types, and the config parser rejects non-string values, but neither was exercised.Graph query functions —
find_action_invokers,find_variable_readers, andfind_variable_writersinsrc/graph/queries.rshad no unit tests, despite being public API used by graph analysis features.Files modified
tests/test_parser_errors.rssrc/graph/queries.rs#[cfg(test)] mod testsblockCargo.toml[[test]]entry fortest_parser_errorsNew tests
tests/test_parser_errors.rstest_none_default_for_string_variable_is_rejectedvariables.rsrejects= Noneformutable stringtest_none_default_for_integer_variable_is_rejected= Noneformutable integertest_none_default_for_boolean_variable_is_valid= Noneformutable boolean(valid case)test_config_field_value_must_be_a_string_literal42) where a string literal is requiredtest_empty_file_parses_to_default_agentAgentFilewith all fields absentsrc/graph/queries.rstest_find_action_invokers_returns_correct_node@actions.get_statuscreates aRefEdge::Invokesedge;find_action_invokers(action_def)returns that reasoning actiontest_find_variable_writers_from_set_clauseset@variables.x =@outputs.yclause creates aRefEdge::Writesedge;find_variable_writers(var)returns the reasoning action that writes it