Lines
95.24 %
Functions
100 %
Branches
//! The acceptance rows of plans 0011 and 0014 run here, through the
//! `Session`: `nms -e` is a convenience, not evidence (0014 §Acceptance-suite
//! repair) — it cannot compile catch-each (an rpc-only import), has no
//! `(rpc-protocol-version)` and no DB natives. A row whose expectation is a
//! catch-each result or a DB value lives in this module.
use super::*;
use nomiscript::{Number, Reader};
mod account_check_log_tests;
mod block_mirror_and_dispatch_tests;
mod cl_boolean_tests;
mod codex_round10_regression_tests;
mod codex_round11_regression_tests;
mod codex_round1_regression_tests;
mod codex_round2_regression_tests;
mod codex_round3_regression_tests;
mod codex_round4_regression_tests;
mod codex_round5_regression_tests;
mod codex_round6_regression_tests;
mod codex_round7_regression_tests;
mod codex_round8_regression_tests;
mod codex_round9_regression_tests;
mod completion_interrupt_tests;
mod engine_error_wire_tests;
mod error_detail_tests;
mod eval_metrics_tests;
mod eval_path_rendering_tests;
mod gj_global_home_tests;
mod identity_effect_tests;
mod instance_wire_tests;
mod list_tests;
mod native_fallback_tests;
mod native_stack_tests;
mod nil_boxing_tests;
mod opaque_wire_tests;
mod persist_bound_tests;
mod persist_closure_tests;
mod persist_tests;
mod phase0_splice_regression_tests;
mod phase3_boolean_tests;
mod phase4_control_tests;
mod phase6_anyref_decode_tests;
mod plan0011_phase3_acceptance_tests;
mod print_output_tests;
mod rebind_trap_tests;
mod request_envelope_tests;
mod session_natives_tests;
mod siteless_closure_wire_tests;
mod stage2_apply_funcall_tests;
mod stage2_captured_store_tests;
mod stage2_designator_tests;
mod stage2_eager_call_tests;
mod stage2_family_a_tests;
mod stage2_fold_error_consumers_tests;
mod stage2_handler_case_value_tests;
mod stage2_head_resolver_tests;
mod stage2_host_builtin_tests;
mod stage2_lambda_default_store_tests;
mod stage2_lambda_list_effects_tests;
mod stage2_let_init_effects_tests;
mod stage2_native_effects_tests;
mod stage2_operation_errors_tests;
mod stage2_probe_store_tests;
mod stage2_raising_mod_tests;
mod stage2_raising_operand_tests;
mod stage2_static_errors_tests;
mod stage2_synth_native_tests;
mod stage2_synth_progn_tests;
mod stage3_alias_chase_tests;
mod stage3_handler_value_tests;
mod stage3_lambda_value_tests;
mod stage3_macro_effect_tests;
mod stage3_macro_key_tests;
mod stage3_macro_list_data_tests;
mod stage3_quote_atoms_tests;
mod stage3_quote_constants_tests;
mod stage3_quote_form_tests;
mod stage3_transfer_tests;
mod stage56_expansion_value_tests;
mod stream_head_tests;
mod wire_depth_tests;
mod wire_list_tests;
async fn handle_form_smoke(frame: &str) -> String {
let ctx = ScriptCtx::new(uuid::Uuid::nil());
let mut session = Session::new(ctx).expect("Session::new");
session.handle_form(frame).await
}
async fn eval_value_of(form: &str) -> String {
handle_form_smoke(&format!("(:id 4 :form {form})")).await
async fn assert_values(cases: &[(&str, &str)]) {
for (form, value) in cases {
assert_eq!(
eval_value_of(form).await,
format!("(:id 4 :value {value})"),
"form {form}"
);
/// A program the compiler can see is ill-typed is rejected whole: nothing runs
/// (user decision ISS-087).
async fn assert_unit_rejected(source: &str, message: &str) {
let mut session = Session::new(ScriptCtx::new(uuid::Uuid::nil())).expect("Session::new");
let outcome = session.handle_request(&format!("(progn {source})")).await;
assert_eq!(outcome.output, "", "{source}: nothing may run");
let ResponsePayload::Error { message: got, .. } = outcome.payload else {
panic!("{source}: expected a compile error");
};
assert_eq!(got, message, "{source}");
async fn assert_builtin_rejected(source: &str, name: &str) {
let message = format!("Compile error: '{name}' is a built-in and cannot be redefined");
assert_unit_rejected(source, &message).await;
async fn assert_error_code(form: &str, code: &str) {
let response = eval_value_of(form).await;
assert!(
response.contains(&format!(":code {code}")),
"{form} must raise {code}, got: {response}"
/// The expected value `value` stands for, as the wire reader would build it:
/// a quoted list is data, not the printed string `eval_program` yields for it.
fn parse_to_value(input: &str) -> Result<Value, NomiError> {
let program = Reader::parse(input)?;
let expr = match program.exprs.into_iter().next() {
Some(nomiscript::Expr::Quote(inner)) => *inner,
Some(expr) => expr,
None => return Ok(Value::Nil),
Ok(crate::response::expr_to_value(expr))
fn value(text: &str) -> ResponsePayload {
ResponsePayload::Value(parse_to_value(text).expect("expected value parses"))