test(tvix/glue): add nonexisting_path_without_import test
This moves the failing example from cl/10285 into its separate test case. There were multiple complications: tvix-[ca]store was panicking in some places, rather than returning an error. This is now fixed. It needs to live in tvix-glue, so we actually have a "proper" EvalIO interface doing something. > toString ({ line = 42; col = 42; file = /deep/thought; }.file) Should not cause an error, because it shouldn't trigger an import, but leave the path as-is, and not care about it not being present. Change-Id: I76f70b3cb1f73a0fb05870375710fd9f67d5603c Reviewed-on: https://cl.tvl.fyi/c/depot/+/10342 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
7165ebc43b
commit
e4d6d20aa7
1 changed files with 18 additions and 0 deletions
|
@ -469,4 +469,22 @@ mod tests {
|
|||
import_path_and_compare(tmpdir.path().join("hello.txt"))
|
||||
);
|
||||
}
|
||||
|
||||
/// Invoke toString on a nonexisting file, and access the .file attribute.
|
||||
/// This should not cause an error, because it shouldn't trigger an import,
|
||||
/// and leave the path as-is.
|
||||
#[test]
|
||||
fn nonexisting_path_without_import() {
|
||||
let result = eval("toString ({ line = 42; col = 42; file = /deep/thought; }.file)");
|
||||
|
||||
assert!(result.errors.is_empty(), "expect evaluation to succeed");
|
||||
let value = result.value.expect("must be some");
|
||||
|
||||
match value {
|
||||
tvix_eval::Value::String(s) => {
|
||||
assert_eq!("/deep/thought", s.as_str());
|
||||
}
|
||||
_ => panic!("unexpected value type: {:?}", value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue