30 lines
827 B
Rust
30 lines
827 B
Rust
use std::fs;
|
|
use tempfile::tempdir;
|
|
use prometeu_compiler::compiler;
|
|
|
|
#[test]
|
|
fn test_project_root_and_entry_resolution() {
|
|
let dir = tempdir().unwrap();
|
|
let project_dir = dir.path();
|
|
|
|
// Create prometeu.json
|
|
fs::write(
|
|
project_dir.join("prometeu.json"),
|
|
r#"{
|
|
"script_fe": "pbs",
|
|
"entry": "src/main.pbs"
|
|
}"#,
|
|
).unwrap();
|
|
|
|
// Create src directory and main.pbs
|
|
fs::create_dir(project_dir.join("src")).unwrap();
|
|
fs::write(project_dir.join("src/main.pbs"), "").unwrap();
|
|
|
|
// Call compile
|
|
let result = compiler::compile(project_dir);
|
|
|
|
// It should now succeed or at least fail at a later stage,
|
|
// but the point of this test is config resolution.
|
|
assert!(result.is_ok(), "Failed to compile: {:?}", result.err());
|
|
}
|