✨Add pls test
command and initial test framework
#83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Since we'll be writing more and more of PlatformScript in PlatformScript, we need a way to test PlatformScript in PlatformScript.
Approach
This adds a
pls test
command that will find all files ending in the.test.yaml
extension in thetest
directory, and runs them as PlatformScript tests.Added to stdlib is the "testing.yaml" module where you can find a test constructor, as well as matchers. The structure of a test is really, really simple for now. It is just a list of expectations:
Matchers are just functions that run on the subject and return a result for it. The following functions are shipped initially to create matchers:
toEqual: expected
: takes an expected value and returns a matcher that passes when the subject is equal to the expected.not: matcher
: takes another matcher and passes only if that matcher fails.This is not the end all be all of testing frameworks, but what it is, is something that we can use to write tests for our PlatformScript as we begin to use it.
Screenshots