feat(tvix/tests): check in Nix' language test suite

This adds scaffolding code for running the Nix language test suite.

The majority of eval-okay-* tests should eventually be runnable as-is
by Tvix, however the eval-fail-* tests might not as we intend to have
more useful error messages than upstream Nix.

Change-Id: I4f3227f0889c55e4274b804a3072850fb78dd1bd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6126
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-08-10 18:53:50 +03:00 committed by tazjin
parent b28da8ad56
commit 92c53fe982
248 changed files with 2217 additions and 9 deletions

View file

@ -1,9 +1,9 @@
use rnix::{self, types::TypedNode};
use crate::errors::EvalResult;
use crate::{errors::EvalResult, value::Value};
pub fn interpret(code: String) -> EvalResult<String> {
let ast = rnix::parse(&code);
pub fn interpret(code: &str) -> EvalResult<Value> {
let ast = rnix::parse(code);
let errors = ast.errors();
if !errors.is_empty() {
@ -15,6 +15,5 @@ pub fn interpret(code: String) -> EvalResult<String> {
let code = crate::compiler::compile(ast)?;
println!("code: {:?}", code);
let value = crate::vm::run_chunk(code)?;
Ok(format!("value: {} :: {}", value, value.type_of()))
crate::vm::run_chunk(code)
}