diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23b9d12..8482fe4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ If you're reading this, thanks for taking a look! If you would like to contribut ## Code of Conduct If you find any bugs or would like to request any features, please open an issue. Once the issue is open, feel free to put in a pull request to fix the issue. Small corrections, like fixing spelling errors, or updating broken urls are appreciated. All pull requests must have adequate testing and review to assure proper function before being accepted. -We encourage an open, friendly, and supportive environment around the development of Passerine. If you disagree with someone for any reason, discuss the issue and express you opinions, don't attack the person. Discrimination of any kind against any person is not permitted. If you detract from this project's collaborative environment, you'll be prevented from participating in the future development of this project until you prove you can behave yourself adequately. Please provide arguments based on anecdotes and reasoning to support your suggestions - don't rely on arguments based on 'years of experience,' supposed skill, job title, etc. to get your points across. +We encourage an open, friendly, and supportive environment around the development of Passerine. If you disagree with someone for any reason, discuss the issue and express you opinions, don't attack the person. Discrimination of any kind against any person is not permitted. If you detract from this project's collaborative environment, you'll be prevented from participating in the future development of this project until you prove you can behave yourself adequately. Please use sound reasoning to support your suggestions - don't rely on arguments based on 'years of experience,' supposed skill, job title, etc. to get your points across. # General Guidelines Readable code with clear behavior works better than illegible optimized code. For things that are very performance-oriented, annotations describing what, how, and why are essential. @@ -30,4 +30,41 @@ Passerine strives to implement a modern compiler pipeline. Passerine is currentl - The command line interface and the package repository, [Aspen](https://github.com/vrtbl/aspen). > TODO: write about project structure -> TODO: integration tests + +# Integration Tests +If you notice any unsound behavior, like an internal compile error or an incorrect, + +1. Reduce the behavior to the minimum required amount of passerine code that causes that error +2. Open an issue explaining what led to the error, what you expected to happen, and the minimum reproducible example. +3. Optionally, add the snippet to `tests/snippets` and test that the test fails (by running `cargo test snippets`). + +## What is a test snippet? +A test snippet is some Passerine code that tests a specific outcome. Here's a simple test snippet: + +```passerine +-- action: run +-- outcome: success +-- expect: "Banana" + +print "Hello, World!" + +"Banana" +``` + +A test snippet starts with a series of comments, each one forming a key-value pair. The `action` is what the compiler should do with the snippet: + +- `lex` +- `parse` +- `desugar` +- `compile` +- `run` + +The outcome specifies the spefic result: + +- No errors are raised: `success` +- A syntax error is raised: `syntax` +- A runtime error is raised: `trace` + +Optionally, if the action is `run` an `outcome` may be specified. This treats the snippet like a function body, and compares the returned value with the expected value. + +Whenever you add a feature, add snippet tests that demonstrate how this feature should (and should not) work. diff --git a/Cargo.toml b/Cargo.toml index 9dfe259..033fbcb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "passerine" -version = "0.8.0" +version = "0.8.1" authors = [ "Isaac Clayton (slightknack) ", "The Passerine Community", diff --git a/tests/snippets/chaining.pn b/tests/snippets/chaining.pn index 0e862a5..960d9f7 100644 --- a/tests/snippets/chaining.pn +++ b/tests/snippets/chaining.pn @@ -1,6 +1,6 @@ --- action: run +-- action: run -- outcome: success --- expect: "Bye" +-- expect: "Bye" i = x -> x bye = x -> "Bye"