about summary refs log tree commit diff
path: root/tvix/eval/src/tests/one_offs.rs
blob: 13b87267a9871868df8cef90938338d22e78b9db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
    );

    let value = result.value.unwrap();
    assert!(
        matches!(value, Value::Integer(42)),
        "expected the integer 42, but got {}",
        value,
    );
}