diff --git a/README.md b/README.md index 158feaa..254d94c 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ implemented. statement, functions - 🌕 stage 1: lazy evaluation - 🌘 stage 2: - - 🌘 built-in functions (progress: 2 out of 111) + - 🌘 built-in functions (progress: 3 out of 111) - 🌑 derivations (hello world derivation) - 🌑 stage 3: full implementation (all derivations in nixpkgs, nice error messages, etc.) diff --git a/flake.lock b/flake.lock index fd56624..07f12ba 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1689413807, - "narHash": "sha256-exuzOvOhGAEKWQKwDuZAL4N8a1I837hH5eocaTcIbLc=", + "lastModified": 1689631193, + "narHash": "sha256-AGSkBZaiTODQc8eT1rZDrQIjtb8JtFwJ0wVPzArlrnM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "46ed466081b9cad1125b11f11a2af5cc40b942c7", + "rev": "57695599bdc4f7bfe5d28cfa23f14b3d8bdf8a5f", "type": "github" }, "original": { @@ -35,11 +35,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1689497845, - "narHash": "sha256-DASATRkvF6Mvkq92q6ntRqQgxNV69qtJZAIJP6nlomc=", + "lastModified": 1689706907, + "narHash": "sha256-A+jUzcZraJYQ9YyfOmKub1ItPl5r/fzlkWr5gNTUOeg=", "owner": "urbas", "repo": "nixrt", - "rev": "0038327e3b16afced4e781570dd27eec72b605df", + "rev": "304a8c13e4b7b8082692ef93a19b92da677908eb", "type": "github" }, "original": { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7de68d0..338c5de 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.70.0" +channel = "1.71.0" components = [ "clippy", "rust-analyzer", "rustfmt" ] profile = "minimal" \ No newline at end of file diff --git a/src/eval/nix_v8.rs b/src/eval/nix_v8.rs index 4c343db..9f68160 100644 --- a/src/eval/nix_v8.rs +++ b/src/eval/nix_v8.rs @@ -1227,18 +1227,13 @@ mod tests { assert_eq!(eval_ok(r#"rec { a = "b"; ${a} = 1; }.b"#), Value::Int(1)); } - #[test] - fn test_eval_builtin_head() { - assert_eq!(eval_ok("builtins.head [ 1 2 ]"), Value::Int(1)); - } - #[test] fn test_eval_lists_are_lazy() { assert_eq!(eval_ok("builtins.head [ 1 (1 / 0) ]"), Value::Int(1)); } #[test] - fn test_eval_abort() { + fn test_eval_builtin_abort() { let error_msg = evaluate(r#"abort "foo""#).unwrap_err(); let expected_msg = "Evaluation aborted with the following error message: 'foo'"; assert!( @@ -1246,4 +1241,14 @@ mod tests { "Error message '{error_msg}' didn't contain '{expected_msg}'." ); } + + #[test] + fn test_eval_builtin_add() { + assert_eq!(eval_ok("builtins.add 1 2"), Value::Int(3)); + } + + #[test] + fn test_eval_builtin_head() { + assert_eq!(eval_ok("builtins.head [ 1 2 ]"), Value::Int(1)); + } }