Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test framework, hover tests, fix hash collision bug #83

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

WillLillis
Copy link
Collaborator

@WillLillis WillLillis commented Jul 1, 2024

This PR does a few things

  • Changes the information maps (names_to_instructions, names_to_registers, and names_to_directives) to hold owned copies of their respective data, rather than references to the data inside of separate Vec. This change was made in order to facilitate easier setup for unit tests, as well as in preparation for the refactor to support Use serde for deserializing the data sources #75.
  • Add a basic unit testing framework. Essential (read-only) parts of the server (just the aforementioned maps for now) are initialized and placed in a static variable accessible to all of the tests.
  • Added unit tests for hover capabilities. The tests added don't offer complete coverage, but do touch a decent chunk of use cases. As bugs are reported (and fixed), the associated reproduction cases can be added as further regression tests.
  • Fixed hash collision bug. To my surprise, the order in which instructions were added to the hashmap was different between different runs of the server. This caused certain instructions with associated names that were also valid instruction names (e.g. one of MOV's associated names is MOVQ) to overwrite the original instructions in the names_to_instructions map.
  • While debugging I also updated the quick_xml crate that we depend on for parsing our various info files.

Next steps include:

  • adding testing for other features (autocomplete, goto defintion, find references, etc.)
  • general cleanup for the testing framework (e.g. supporting/ testing different server configurations)

@WillLillis WillLillis enabled auto-merge (squash) July 2, 2024 14:31
@WillLillis WillLillis merged commit 845d954 into bergercookie:master Jul 2, 2024
15 checks passed
@WillLillis WillLillis deleted the unit_testing branch July 3, 2024 23:35
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.

None yet

1 participant