Skip to content

Separate tests for preamble, lib/, and rt/ #64

@ssoelvsten

Description

@ssoelvsten

With #54 , I've been laying out the foundations for a standard library. While doing so, I only ran the new test file in tests/lib/ rather than the entire test suite. Yet, since some rt/core tests depend on the same library, my pull request broke. But, the library is not part of the core of Troupe and should not be tested there.

The goal of tests is to document intended behaviour and to guide debugging efforts. Since most programs in tests/ are system tests, i.e. are running the entire pipeline rather than a single module, the tests ought to adhere to the criteria below. If this is achieved, then the combination of succeeding and failing tests can more quickly guide the developer towards the origin of a bug.

Test Design Criteria:

  1. Tests should only test the one thing as is documented in its name and/or a comment.
  2. Tests should be independent of code that is not directly intended to be under test.

Examples of tests violating the above:

  • tests/rt/pos/core/float_ops.trp is testing multiple operations [1]. It ought to be split into several files.
  • tests/rt/pos/core/float_ops.trp (and many, many other tests) uses print which is part of the preamble and not the Troupe core [2]. Instead, fwrite should be used.
  • tests/rt/pos/core/string_manipulations.trp is superseeded by tests/lib/String.trp and should be deleted [2].

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomers📁 ./testsChanges and additions to the testing suite

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions