Skip to content

Small fix: avoid leaving files after tests run

Konstantin Ivanov requested to merge martoon/fix-output-in-tests into master

Description

Problem: after I run tests, I constantly get Sample.tz and Sample2.tz files appearing as unstaged in git status.

Solution: normally tests should not leave any files, maybe except for in the temp directory.

Here we rather check that files are created and simultaneously delete them.

Also applied some minor refactoring, namely to avoid using Control.Exception and use try and throwM from Prelude's (which re-exports methods from exceptions-safe package). This is pretty actual here since we don't want to catch user interrupts and other async exceptions, rather only exceptions related to the current test suite.

Related issue(s)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Konstantin Ivanov

Merge request reports