Lite is a test runner for compiler-like Swift programs. It is structured
similarly to LLVM's
with way fewer configuration options. Its advantage is being easily usable from
a Swift project.
lite as a testing tool, you'll need to add
Lite as a dependency in
.package(url: "https://github.com/silt-lang/Lite.git", from: "0.0.1")
Then, you'll need to add a target called
lite to your Package.swift that
depends on the Lite support library,
.target(name: "lite", dependencies: ["LiteSupport"])
From that target's
main.swift, make a call to
runLite(substitutions:pathExtensions:testDirPath:testLinePrefix:parallelismLevel:). This call
is the main entry point to
lite's test running.
It takes 5 arguments:
||The mapping of substitutions to make inside each run line. A substitution looks for a string beginning with
||The set of path extensions that Lite should search for when discovering tests.|
||The directory in which Lite should look for tests. Lite will perform a deep search through this directory for all files whose extension exists in
||The prefix before
||Specifies the amount of parallelism to apply to the test running process. Default value is
Note: An example consumer of
Liteexists in this repository as
Once you've defined that, you're ready to start running your tester!
You can run it standalone or via CI using:
swift run lite
Lite tests are expressed as
bash shell commands written inside comments
in your source file (usually at the top).
These commands can be very simple:
// RUN: %my-prog %s
Or very complex:
// RUN: %my-prog %s --arg1 foo --directory %T --output-file %t && diff %T/foo.out %t
You can also have multiple
RUN lines in one file, which will all use the same
set of substitutions.
Lite comes with 4 standard substitutions:
||The current source file path, quoted.|
||The directory in which the current source file resides, quoted.|
||A temporary directory which will be created when substituted.|
||A temporary file (multiple
Harlan Haskins (@harlanhaskins)
Robert Widmann (@codafi)
This project is released under the MIT license, a copy of which is avaialable in this repository.
|Last commit: 1 week ago|