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

Put exercise generation under test #426

Merged
merged 2 commits into from
Oct 20, 2020
Merged

Put exercise generation under test #426

merged 2 commits into from
Oct 20, 2020

Commits on Oct 14, 2020

  1. Put exercise generation under test

    This change alters `ExercismGenerator` just enough to allow side effect free
    tests. Having the class under test enables future refactoring. Three dependancies
    made this class difficult to test:
    - `PipeableOSProcess` executed commands outside of the Pharo VM
    - `ExTonelWriter` wrote files to the OS filesystem
    - `ExercismExercise` would access a variable number of exercises depending on how many were implemented
    
    To get this class under test the above dependancies have been placed in lazy
    assigned instance variables. This allows tests to assign mocks to the generator
    instance.
    
    There are two mock OS processes, one that always succeeds, and one that always fails.
    Neither executes any function outside the VM.
    
    A  `ExTonelWriter` writes exercises to an in memory file system that lasts only
    for the test.
    
    A mock exercism exercise class returns only a single exercise. This speeds up the
    test and makes it more consistent as it won't change when more exercises are implemented.
    Samuel Wilson committed Oct 14, 2020
    Configuration menu
    Copy the full SHA
    dbf6a02 View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2020

  1. Force use of common line endings in test assertions

    The change is a test that passed on my personal computer (MacOS) but failed in CI (Ubuntu 16.04).
    
    I suspect that even though the tests use an in memory file system OS specific line-feed and carrage-return
    characters will be used causing enough of a difference between the expected result and the actual
    result of the test to fail. This change makes the line ending characters of the actual and expected results
    identical before asserting.
    
    The test design closely follows that of `TonelWriterTest` which also uses an in memory file system.
    Samuel Wilson committed Oct 17, 2020
    Configuration menu
    Copy the full SHA
    0aa5ac3 View commit details
    Browse the repository at this point in the history