Merge pull request #220630 from tricktron/f-bats-1.9.0

This commit is contained in:
Sandro 2023-03-14 22:25:40 +01:00 committed by GitHub
commit a60b7589bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 11 deletions

View File

@ -22,13 +22,13 @@
resholve.mkDerivation rec {
pname = "bats";
version = "1.8.2";
version = "1.9.0";
src = fetchFromGitHub {
owner = "bats-core";
repo = "bats-core";
rev = "v${version}";
sha256 = "sha256-Kitlx26cK2RiAC+PdRIdDLF5crorg6UB6uSzbKCrDHE=";
sha256 = "sha256-nKBNbqJYRd/3tO85E6KrOh32yOaNKpLXxz5gQ5Uvmcc=";
};
patchPhase = ''
@ -91,6 +91,8 @@ resholve.mkDerivation rec {
"$pre_command" = true;
"$BATS_TEST_NAME" = true;
"${placeholder "out"}/libexec/bats-core/bats-exec-test" = true;
"$BATS_LINE_REFERENCE_FORMAT" = "comma_line";
"$BATS_LOCKING_IMPLEMENTATION" = "${flock}/bin/flock";
};
execer = [
/*
@ -136,8 +138,15 @@ resholve.mkDerivation rec {
setup() {
bats_load_library bats-support
bats_load_library bats-assert
bats_load_library bats-file
bats_require_minimum_version 1.5.0
TEST_TEMP_DIR="$(temp_make --prefix 'nixpkgs-bats-test')"
}
teardown() {
temp_del "$TEST_TEMP_DIR"
}
@test echo_hi {
@ -150,10 +159,17 @@ resholve.mkDerivation rec {
assert_line --index 0 "cp: missing file operand"
assert_line --index 1 "Try 'cp --help' for more information."
}
@test file_exists {
echo "hi" > "$TEST_TEMP_DIR/hello.txt"
assert_file_exist "$TEST_TEMP_DIR/hello.txt"
run cat "$TEST_TEMP_DIR/hello.txt"
assert_output "hi"
}
'';
passAsFile = [ "testScript" ];
} ''
${bats.withLibraries (p: [ p.bats-support p.bats-assert ])}/bin/bats "$testScriptPath"
${bats.withLibraries (p: [ p.bats-support p.bats-assert p.bats-file ])}/bin/bats "$testScriptPath"
touch "$out"
'';

View File

@ -1,12 +1,12 @@
{ lib, stdenv, fetchFromGitHub }: {
bats-assert = stdenv.mkDerivation {
bats-assert = stdenv.mkDerivation rec {
pname = "bats-assert";
version = "2.0.0";
version = "2.1.0";
src = fetchFromGitHub {
owner = "bats-core";
repo = "bats-assert";
rev = "v2.0.0";
sha256 = "sha256-whSbAj8Xmnqclf78dYcjf1oq099ePtn4XX9TUJ9AlyQ=";
rev = "v${version}";
sha256 = "sha256-opgyrkqTwtnn/lUjMebbLfS/3sbI2axSusWd5i/5wm4=";
};
dontBuild = true;
installPhase = ''
@ -23,13 +23,13 @@
};
};
bats-file = stdenv.mkDerivation {
bats-file = stdenv.mkDerivation rec {
pname = "bats-file";
version = "0.3.0";
src = fetchFromGitHub {
owner = "bats-core";
repo = "bats-file";
rev = "v0.3.0";
rev = "v${version}";
sha256 = "sha256-3xevy0QpwNZrEe+2IJq58tKyxQzYx8cz6dD2nz7fYUM=";
};
dontBuild = true;
@ -47,13 +47,13 @@
};
};
bats-support = stdenv.mkDerivation {
bats-support = stdenv.mkDerivation rec {
pname = "bats-support";
version = "0.3.0";
src = fetchFromGitHub {
owner = "bats-core";
repo = "bats-support";
rev = "v0.3.0";
rev = "v${version}";
sha256 = "sha256-4N7XJS5XOKxMCXNC7ef9halhRpg79kUqDuRnKcrxoeo=";
};
dontBuild = true;