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 fail with "Frontend 'pbs' not yet implemented" // but ONLY after successfully loading the config and resolving the entry. match result { Err(e) => { let msg = e.to_string(); assert!(msg.contains("Frontend 'pbs' not yet implemented"), "Unexpected error: {}", msg); } Ok(_) => panic!("Should have failed as pbs is not implemented yet"), } }