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

Make failing tests possible, improve test output. #123

Merged
merged 1 commit into from
Apr 18, 2015
Merged

Make failing tests possible, improve test output. #123

merged 1 commit into from
Apr 18, 2015

Commits on Apr 16, 2015

  1. Make failing tests possible, improve test output.

    Until now it has been possible to test only that something succeeds
    (specifically, that the output matches exactly). This limited the
    tests to cases where we had determinism and where the expected output
    was exactly known.
    
    This commit extends test.sh to maintain the old functionality, but now
    ALSO allows checking scripts to be used instead of the old `.out` files.
    
    A checking script is an executable whose name is that of a test, but
    with the ending `.chk` -- if the test source if called `foo.enc`, the
    checking script is called `foo.chk` and it is executable. The file
    testutils.sh contains a few functions to make it easier to write tests
    and to make maintenance of tests easier, should error output change
    (then only this file has to be updated).
    
    The `make test` command will now compile `foo.enc` and try to run it
    (if compilation succeeds). The output of both compilation and
    execution will be piped into the checking script. The checking script
    can analyse the input and return successfully to signal that
    everything is ok, or with a failure code to signal an error.
    
    An example:
    
    File fail.enc:
    
        class Main
          def main() : void
            repeat i <- 100 {
              print x -- error should occur here
            }
    
    File fail.chk:
    
        #!/usr/bin/env bash
        source testutils.sh
    
        error_at 4
        error_msg "Unbound variable 'x'"
    Stephan Brandauer committed Apr 16, 2015
    Configuration menu
    Copy the full SHA
    9b4c5b0 View commit details
    Browse the repository at this point in the history