Crate whiley_test_file
source · [−]Expand description
A library for parsing Whiley test files according to RFC#110 which are used for testing the Whiley compiler. Each test describes a sequence of modifications to one of more Whiley files, along with the expected outcomes (e.g. errors, warnings, etc). An example test file is the following:
whiley.verify = false
boogie.timeout = 1000
================
>>> main.whiley
method main():
>>> other.whiley
import main
---
E101 main.whiley 1,2
E302 main.whiley 2,2:3
================
<<< other.whiley
>>> main.whiley 1:1
method main()
skip
---
This is a test involving two files: main.whiley
and other.whiley
.
The initial frame sets the contents of main.whiley
to method main()
and the contents of other.whiley
to import main
.
Furthermore, compiling this frame is expected to produce two errors
(E101
and E302
). The second frame deletes file other.whiley
and
updates the contents of main.whiley
. Furthermore, compiling the
snapshot at this point is not expected to produce any errors.
use std::fs;
use whiley_test_file::WhileyTestFile;
fn load(filename: &str) {
// Read the test file
let input = fs::read_to_string(filename).unwrap();
// Parse test file
let test_file = WhileyTestFile::new(&input).unwrap();
// ...
}
Structs
Identifies a specific range of characters within a file.
Represents a frame within a testfile. Each frame identifies a number of actions which operate on the state at that point, along with zero or more expected markers (e.g. error messages). The set of actions includes inserting and removing lines on a specific file. Actions are applied in the order of appearance, though they are not expected to overlap.
Identifies an expected error at a location in a given source file.
Represents an interval (e.g. of characters within a line).
Enums
Represents an atomic action which can be applied to a source file, such as inserting or replacing lines within the file.