diff --git a/flake.nix b/flake.nix index a0f8d00..f1e75b3 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,7 @@ rust-toolchain pkgs.cargo-release pkgs.cargo-expand + pkgs.foundry-bin pkgs.gmp pkgs.openssl pkgs.libusb1 @@ -343,6 +344,7 @@ body = '' bats test/bats/devshell/rust-shell/closure.test.bats bats test/bats/devshell/rust-shell/cargo-expand.test.bats + bats test/bats/devshell/rust-shell/anvil.test.bats ''; additionalBuildInputs = [ pkgs.bats ] ++ rust-build-inputs; }; diff --git a/test/bats/devshell/rust-shell/anvil.test.bats b/test/bats/devshell/rust-shell/anvil.test.bats new file mode 100644 index 0000000..bec9653 --- /dev/null +++ b/test/bats/devshell/rust-shell/anvil.test.bats @@ -0,0 +1,4 @@ +@test "anvil should be available on PATH" { + run anvil --version + [ "$status" -eq 0 ] +} diff --git a/test/bats/devshell/rust-shell/closure.test.bats b/test/bats/devshell/rust-shell/closure.test.bats index 3537bfb..1b3602f 100644 --- a/test/bats/devshell/rust-shell/closure.test.bats +++ b/test/bats/devshell/rust-shell/closure.test.bats @@ -7,10 +7,10 @@ # time CI evaluates the shell. # # This file inspects rust-shell's full closure (`nix-store -q -# --requisites`) and fails if any sol toolchain, node/npm, or chromium -# component shows up. rust-shell is for repos that ship a pure rust -# binary (rain.cli, rain.metadoc, etc.) and should not pull in foundry, -# slither, solc, nodejs, or chromium. +# --requisites`) and fails if slither, solc, node/npm, or chromium +# show up. rust-shell ships foundry-bin so that alloy's Anvil::new() +# spawn works in cargo tests, but does not pull in the rest of the +# Solidity static-analysis toolchain. # # Skips when `nix` is not on PATH (e.g. running the bats files under a # stripped sandbox); CI invokes via nix and so always exercises this. @@ -28,11 +28,11 @@ setup() { CLOSURE="$(nix-store -q --requisites "$RUST_SHELL_OUT")" } -@test "rust-shell closure has no foundry toolchain" { +@test "rust-shell closure has no slither or solc" { local hits - hits="$(echo "$CLOSURE" | grep -E '/nix/store/[^/]*-(foundry-|solc-static-|slither-analyzer-)' || true)" + hits="$(echo "$CLOSURE" | grep -E '/nix/store/[^/]*-(solc-static-|slither-analyzer-)' || true)" if [ -n "$hits" ]; then - echo "FAIL: rust-shell closure references sol toolchain components:" >&2 + echo "FAIL: rust-shell closure references sol static-analysis components:" >&2 echo "$hits" >&2 return 1 fi