Skip to content

Commit

Permalink
implemented the 'abort' builtin
Browse files Browse the repository at this point in the history
  • Loading branch information
urbas committed Jul 16, 2023
1 parent 08d68d8 commit b6f2328
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ implemented.
statement, functions
- 🌕 stage 1: lazy evaluation
- 🌘 stage 2:
- 🌘 built-in functions (progress: 1 out of 111)
- 🌘 built-in functions (progress: 2 out of 111)
- 🌑 derivations (hello world derivation)
- 🌑 stage 3: full implementation (all derivations in nixpkgs, nice error
messages, etc.)
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/eval/nix_v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,4 +1236,14 @@ mod tests {
fn test_eval_lists_are_lazy() {
assert_eq!(eval_ok("builtins.head [ 1 (1 / 0) ]"), Value::Int(1));
}

#[test]
fn test_eval_abort() {
let error_msg = evaluate(r#"abort "foo""#).unwrap_err();
let expected_msg = "Evaluation aborted with the following error message: 'foo'";
assert!(
error_msg.contains(expected_msg),
"Error message '{error_msg}' didn't contain '{expected_msg}'."
);
}
}

0 comments on commit b6f2328

Please sign in to comment.