Hello community,

here is the log from the commit of package bats for openSUSE:Factory checked in 
at 2020-12-17 17:05:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/bats (Old)
 and      /work/SRC/openSUSE:Factory/.bats.new.5145 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "bats"

Thu Dec 17 17:05:39 2020 rev:9 rq:856627 version:1.2.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/bats/bats.changes        2020-11-23 
10:22:12.892802182 +0100
+++ /work/SRC/openSUSE:Factory/.bats.new.5145/bats.changes      2020-12-17 
17:09:10.377962995 +0100
@@ -1,0 +2,6 @@
+Thu Dec 17 00:43:18 UTC 2020 - Aleksa Sarai <[email protected]>
+
+- Backport <https://github.com/bats-core/bats-core/pull/344>. bsc#1180135
+  + bsc1180135-0001-fix-dont-use-unbound-variables-in-setup-methods.patch
+
+-------------------------------------------------------------------
@@ -18,0 +25,6 @@
+
+-------------------------------------------------------------------
+Fri Jul  3 01:08:46 UTC 2020 - Aleksa Sarai <[email protected]>
+
+- Require gnu_parallel so that 'bats --jobs' works out of the box and is tested
+  as part of the integration tests of the package.

New:
----
  bsc1180135-0001-fix-dont-use-unbound-variables-in-setup-methods.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bats.spec ++++++
--- /var/tmp/diff_new_pack.xGP48Y/_old  2020-12-17 17:09:10.893963508 +0100
+++ /var/tmp/diff_new_pack.xGP48Y/_new  2020-12-17 17:09:10.897963512 +0100
@@ -25,7 +25,10 @@
 Group:          Development/Tools/Other
 URL:            https://github.com/%{pname}/%{pname}/
 Source:         https://github.com/%{pname}/%{pname}/archive/v%{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
+Requires:       gnu_parallel
 BuildArch:      noarch
 
 %description
@@ -41,6 +44,8 @@
 
 %prep
 %setup -q -n %{pname}-%{version}
+# bsc#1180135
+%patch1 -p1
 
 sed -i '1s|#!%{_bindir}/env bash|#!/bin/bash|' ./lib{,exec}/%{pname}/* 
./bin/bats
 %if 0%{?suse_version} <= 1500

++++++ bsc1180135-0001-fix-dont-use-unbound-variables-in-setup-methods.patch 
++++++
From 43b8ae1444e2faf62a80455eafa42d0b02709423 Mon Sep 17 00:00:00 2001
From: Martin Schulze <[email protected]>
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
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to