about summary refs log blame commit diff
path: root/tvix/eval/src/tests/one_offs.rs
blob: 63bb8f7af378acf4b864fcd59080fdaff371f53a (plain) (tree)


















                                                                              
use crate::*;

#[test]
fn test_source_builtin() {
    // Test an evaluation with a source-only builtin. The test ensures
    // that the artificially constructed thunking is correct.

    let mut eval = Evaluation::new_impure("builtins.testSourceBuiltin", None);
    eval.src_builtins.push(("testSourceBuiltin", "42"));

    let result = eval.evaluate();
    assert!(
        result.errors.is_empty(),
        "evaluation failed: {:?}",
        result.errors
    );

    assert!(matches!(result.value.unwrap(), Value::Integer(42)));
}