1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Source-level integration tests.
//!
//! Fixture `.cljrs` files live in `<workspace-root>/tests/fixtures/`.
//! Tests here are `#[ignore]`d until the reader and evaluator land in
//! Phase 2 and Phase 4 respectively.
use std::path::PathBuf;
fn fixtures_dir() -> PathBuf {
// crates/cljrs is two levels below the workspace root.
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("../..")
.join("tests/fixtures")
}
#[test]
#[ignore = "requires Phase 2 reader"]
fn run_fixture_files() {
let dir = fixtures_dir();
let entries: Vec<_> = std::fs::read_dir(&dir)
.expect("fixtures dir should exist")
.filter_map(|e| e.ok())
.filter(|e| {
e.path()
.extension()
.map(|x| x == "cljrs" || x == "cljc")
.unwrap_or(false)
})
.collect();
assert!(
!entries.is_empty(),
"no .cljrs/.cljc fixture files found in {}",
dir.display()
);
for entry in entries {
let path = entry.path();
// TODO(Phase 4): feed each file through the interpreter and assert
// it produces the expected result (encoded in a `; => value` comment).
println!("fixture: {}", path.display());
}
}