Skip to content

Integration testing by implementing a toy language #141

Open
@MalteJanz

Description

@MalteJanz

There should be a simple toy language and toy syntax tree to test all / most of the tree api methods (traversal and accessing specific nodes / tokens).

This issue tries to improve the testing situation in rowan, so things like #139 (off-by-one-error) can be caught at an early stage and projects depending on this library don't have to find these bugs the hard way. This should also allow for easier refactoring / internal changes with the confidence, that the public api still works as expected. Also future PRs which provide bug fixes for the public API can also provide a test for it to help increase the coverage.

steps to do this (out of my head / only a suggestion for the implementation):

  • Add a test directory for the integration tests
  • Write a module toy_language inside the test directory
    • Implement all the necessary things for rowan (see examples and Make A Language Blog )
    • Instead of writing a complete lexer / parser, simply write a method build_toy_tree which uses the GreenNodeBuilder and constructs a meaningful tree by hand (which provides enough depth / siblings / ... to use for testing)
  • Confirm the toy_language tree and underlaying source string looks like expected by writing two tests for this
  • Start implementing tests for the tree traversal / accessing tree nodes API

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions