SHA256
1
0
forked from pool/bats

Accepting request 886488 from home:susnux:branches:devel:tools

Update to 1.3.0

OBS-URL: https://build.opensuse.org/request/show/886488
OBS-URL: https://build.opensuse.org/package/show/devel:tools/bats?expand=0&rev=21
This commit is contained in:
Olav Reinert 2021-04-18 19:21:42 +00:00 committed by Git OBS Bridge
parent 39768de0cd
commit 080e1577bd
5 changed files with 32 additions and 90 deletions

3
bats-core-1.3.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1d5075e6e712dc15fbe818b9d88605dbc8908269857f054b046321a4b9cba089
size 78392

View File

@ -1,3 +1,29 @@
-------------------------------------------------------------------
Sun Apr 18 17:54:00 UTC 2021 - Ferdinand Thiessen <rpm@fthiessen.de>
- Update to 1.3.0
* Added custom test-file extension via BATS_FILE_EXTENSION when
searching for test files in a directory
* Added TAP13 formatter, including millisecond timing
* Recursive suite mode will follow symlinks now
* Split options for (file-) --report-formatter and (stdout)
--formatter
WARNING: This changes the meaning of --formatter junit.
stdout will now show unified xml instead of TAP. From now on,
please use --report-formatter junit to obtain the .xml report file!
* Removed --parallel-preserve-environment flag, as this is the default
* Preprocessed files are no longer removed if --no-tempdir-cleanup
is specified
* Fix internal failures due to unbound variables when test files
use set -u
* Fix internal failures due to changes to $PATH in test files
* Fix hangs on CTRL+C
* Make BATS_TEST_NUMBER count per file again
* Performance improvements
* Improved documentation
- Dropped upstream merged
bsc1180135-0001-fix-dont-use-unbound-variables-in-setup-methods.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Dec 17 00:43:18 UTC 2020 - Aleksa Sarai <asarai@suse.com> Thu Dec 17 00:43:18 UTC 2020 - Aleksa Sarai <asarai@suse.com>

View File

@ -1,7 +1,7 @@
# #
# spec file for package bats # spec file for package bats
# #
# Copyright (c) 2020 SUSE LLC # Copyright (c) 2021 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -18,15 +18,13 @@
%define pname %{name}-core %define pname %{name}-core
Name: bats Name: bats
Version: 1.2.1 Version: 1.3.0
Release: 0 Release: 0
Summary: Bash Automated Testing System Summary: Bash Automated Testing System
License: MIT License: MIT
Group: Development/Tools/Other Group: Development/Tools/Other
URL: https://github.com/%{pname}/%{pname}/ URL: https://github.com/%{pname}/%{pname}/
Source: https://github.com/%{pname}/%{pname}/archive/v%{version}.tar.gz Source: %{URL}/archive/v%{version}.tar.gz#/%{pname}-%{version}.tar.gz
# FIX-UPSTREAM: Backport of https://github.com/bats-core/bats-core/pull/344. bsc#1180135
Patch1: bsc1180135-0001-fix-dont-use-unbound-variables-in-setup-methods.patch
BuildRequires: ncurses-utils BuildRequires: ncurses-utils
Requires: gnu_parallel Requires: gnu_parallel
BuildArch: noarch BuildArch: noarch
@ -44,8 +42,6 @@ to test any UNIX program.
%prep %prep
%setup -q -n %{pname}-%{version} %setup -q -n %{pname}-%{version}
# bsc#1180135
%patch1 -p1
sed -i '1s|#!%{_bindir}/env bash|#!/bin/bash|' ./lib{,exec}/%{pname}/* ./bin/bats sed -i '1s|#!%{_bindir}/env bash|#!/bin/bash|' ./lib{,exec}/%{pname}/* ./bin/bats
%if 0%{?suse_version} <= 1500 %if 0%{?suse_version} <= 1500

View File

@ -1,80 +0,0 @@
From 43b8ae1444e2faf62a80455eafa42d0b02709423 Mon Sep 17 00:00:00 2001
From: Martin Schulze <martin.schulze@vireso.de>
Date: Mon, 17 Aug 2020 23:22:31 +0200
Subject: [PATCH] fix: don't use unbound variables in setup methods
- fixes #340
---
lib/bats-core/test_functions.bash | 2 +-
test/bats.bats | 13 +++++++++++
.../bats/set_-eu_in_setup_and_teardown.bats | 23 +++++++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 test/fixtures/bats/set_-eu_in_setup_and_teardown.bats
diff --git a/lib/bats-core/test_functions.bash b/lib/bats-core/test_functions.bash
index 9eded0c0309a..e1fbb2a9f49a 100644
--- a/lib/bats-core/test_functions.bash
+++ b/lib/bats-core/test_functions.bash
@@ -54,7 +54,7 @@ teardown() {
skip() {
# if this is a skip in teardown ...
- if [[ -n "$BATS_TEARDOWN_STARTED" ]]; then
+ if [[ -n "${BATS_TEARDOWN_STARTED-}" ]]; then
# ... we want to skip the rest of teardown.
# communicate to bats_exit_trap that the teardown was completed without error
# shellcheck disable=SC2034
diff --git a/test/bats.bats b/test/bats.bats
index 1dc7e5be635c..73fb54459b28 100755
--- a/test/bats.bats
+++ b/test/bats.bats
@@ -576,3 +576,16 @@ END_OF_ERR_MSG
run bash -c "echo $'1..1\nok 1' | bats_test_count_validator"
[[ $status -eq 0 ]]
}
+
+@test "Don't use unbound variables inside bats (issue #340)" {
+ run bats "$FIXTURE_ROOT/set_-eu_in_setup_and_teardown.bats"
+ echo "$output"
+ [[ "${lines[0]}" == "1..4" ]]
+ [[ "${lines[1]}" == "ok 1 skipped test # skip" ]]
+ [[ "${lines[2]}" == "ok 2 skipped test with reason # skip reason" ]]
+ [[ "${lines[3]}" == "ok 3 passing test" ]]
+ [[ "${lines[4]}" == "not ok 4 failing test" ]]
+ [[ "${lines[5]}" == "# (in test file $RELATIVE_FIXTURE_ROOT/set_-eu_in_setup_and_teardown.bats, line 22)" ]]
+ [[ "${lines[6]}" == "# \`false' failed" ]]
+ [[ "${#lines[@]}" -eq 7 ]]
+}
diff --git a/test/fixtures/bats/set_-eu_in_setup_and_teardown.bats b/test/fixtures/bats/set_-eu_in_setup_and_teardown.bats
new file mode 100644
index 000000000000..e9879f0ab54e
--- /dev/null
+++ b/test/fixtures/bats/set_-eu_in_setup_and_teardown.bats
@@ -0,0 +1,23 @@
+setup() {
+ set -eu
+}
+
+teardown() {
+ set -eu
+}
+
+@test "skipped test" {
+ skip
+}
+
+@test "skipped test with reason" {
+ skip "reason"
+}
+
+@test "passing test" {
+ run true
+}
+
+@test "failing test" {
+ false
+}
\ No newline at end of file
--
2.29.2

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:91c49b1fe6f0656c46491929ed728f8dfa9a96df0cce294963e8c6082bff87a2
size 62685