diff --git a/crates/aiken-project/src/lib.rs b/crates/aiken-project/src/lib.rs index 43a06893..1519094a 100644 --- a/crates/aiken-project/src/lib.rs +++ b/crates/aiken-project/src/lib.rs @@ -10,8 +10,8 @@ pub mod options; pub mod package_name; pub mod paths; pub mod pretty; -pub mod script; pub mod telemetry; +pub mod test_framework; #[cfg(test)] mod tests; pub mod watch; @@ -47,7 +47,6 @@ use pallas::ledger::{ primitives::babbage::{self as cardano, PolicyId}, traverse::ComputeHash, }; -use script::{Assertion, Fuzzer, Test, TestResult}; use std::{ collections::HashMap, fs::{self, File}, @@ -56,6 +55,7 @@ use std::{ rc::Rc, }; use telemetry::EventListener; +use test_framework::{Assertion, Fuzzer, Test, TestResult}; use uplc::{ ast::{DeBruijn, Name, NamedDeBruijn, Program, Term}, machine::cost_model::ExBudget, diff --git a/crates/aiken-project/src/telemetry.rs b/crates/aiken-project/src/telemetry.rs index e17bd7d4..fa9402b4 100644 --- a/crates/aiken-project/src/telemetry.rs +++ b/crates/aiken-project/src/telemetry.rs @@ -1,5 +1,5 @@ use crate::pretty; -use crate::script::{PropertyTestResult, TestResult, UnitTestResult}; +use crate::test_framework::{PropertyTestResult, TestResult, UnitTestResult}; use aiken_lang::{expr::UntypedExpr, format::Formatter}; use owo_colors::{OwoColorize, Stream::Stderr}; use std::{collections::BTreeMap, fmt::Display, path::PathBuf}; diff --git a/crates/aiken-project/src/script.rs b/crates/aiken-project/src/test_framework.rs similarity index 98% rename from crates/aiken-project/src/script.rs rename to crates/aiken-project/src/test_framework.rs index ff297682..2ce11297 100644 --- a/crates/aiken-project/src/script.rs +++ b/crates/aiken-project/src/test_framework.rs @@ -310,7 +310,7 @@ impl Prng { /// Obtain a Prng back from a fuzzer execution. As a reminder, fuzzers have the following /// signature: /// - /// type Fuzzer = fn(Prng) -> Option<(Prng, a)> + /// type Fuzzer = fn(Prng) -> Option<(Prng, a)> /// /// In nominal scenarios (i.e. when the fuzzer is made from a seed and evolve pseudo-randomly), /// it cannot yield 'None'. When replayed however, we can't easily guarantee that the changes @@ -341,7 +341,7 @@ impl Prng { } } - panic!("Malformed Prng: {cst:#?}") + unreachable!("Malformed Prng: {cst:#?}") } fn as_u32(field: &PlutusData) -> u32 { @@ -349,7 +349,7 @@ impl Prng { return u32::try_from(*i).expect("Choice doesn't fit in u32?"); } - panic!("Malformed choice's value: {field:#?}") + unreachable!("Malformed choice's value: {field:#?}") } if let Term::Constant(rc) = &result { @@ -372,9 +372,6 @@ impl Prng { } } - // In principle, this cannot happen provided that the 'result' was produced from a - // type-checked fuzzer. The type-checker enforces that fuzzers are of the right shape - // describe above. unreachable!("Fuzzer yielded a malformed result? {result:#?}") } }