jobcore/mkinitcpio/test-use-system-library-loa...

101 lines
2.9 KiB
Diff

From eba62eadec261da0e8f1fb9e95849057679daf07 Mon Sep 17 00:00:00 2001
From: Levente Polyak <anthraxx@archlinux.org>
Date: Sat, 16 Dec 2023 13:51:25 +0100
Subject: [PATCH] test: use system library loading mechanism instead of
absolute paths
This resolves system libraries automatically from the canonical paths,
or falls back to `BATS_LIB_PATH`.
Previously this was not possible as bats plugins were not packaged at
the appropriate path in /usr/lib/bats/* which resulted in the plugin
auto loading not being able to resolve the libraries. This has been
fixed now, so lets use the recommended way to load libraries.
https://bats-core.readthedocs.io/en/stable/writing-tests.html#bats-load-library-load-system-wide-libraries
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
---
test/cases/bash-completion.bats | 4 ++--
test/cases/extglob.bats | 2 +-
test/cases/functions.bats | 4 ++--
test/cases/parse_cmdline.bats | 4 ++--
test/cases/zsh-completion.bats | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/test/cases/bash-completion.bats b/test/cases/bash-completion.bats
index 4d358ad..a47a495 100644
--- a/test/cases/bash-completion.bats
+++ b/test/cases/bash-completion.bats
@@ -3,8 +3,8 @@
shopt -s extglob
-load '/usr/lib/bats-assert/load'
-load '/usr/lib/bats-support/load'
+bats_load_library 'bats-assert'
+bats_load_library 'bats-support'
load "../helpers/common"
setup() {
diff --git a/test/cases/extglob.bats b/test/cases/extglob.bats
index 4eeda72..6da116c 100644
--- a/test/cases/extglob.bats
+++ b/test/cases/extglob.bats
@@ -1,6 +1,6 @@
#!/usr/bin/env bats
# SPDX-License-Identifier: GPL-2.0-only
-load '/usr/lib/bats-support/load'
+bats_load_library 'bats-support'
@test "check for syntax errors" {
local bash_scripts=(mkinitcpio lsinitcpio)
diff --git a/test/cases/functions.bats b/test/cases/functions.bats
index c1f4e8b..f3d356c 100644
--- a/test/cases/functions.bats
+++ b/test/cases/functions.bats
@@ -3,8 +3,8 @@
shopt -s extglob
-load '/usr/lib/bats-assert/load'
-load '/usr/lib/bats-support/load'
+bats_load_library 'bats-assert'
+bats_load_library 'bats-support'
load "../helpers/common"
setup() {
diff --git a/test/cases/parse_cmdline.bats b/test/cases/parse_cmdline.bats
index a265d9f..dd603fc 100644
--- a/test/cases/parse_cmdline.bats
+++ b/test/cases/parse_cmdline.bats
@@ -3,8 +3,8 @@
shopt -s extglob
-load '/usr/lib/bats-assert/load'
-load '/usr/lib/bats-support/load'
+bats_load_library 'bats-assert'
+bats_load_library 'bats-support'
load "../helpers/common"
setup() {
diff --git a/test/cases/zsh-completion.bats b/test/cases/zsh-completion.bats
index 3e6526e..500a756 100644
--- a/test/cases/zsh-completion.bats
+++ b/test/cases/zsh-completion.bats
@@ -3,8 +3,8 @@
shopt -s extglob
-load '/usr/lib/bats-assert/load'
-load '/usr/lib/bats-support/load'
+bats_load_library 'bats-assert'
+bats_load_library 'bats-support'
load "../helpers/common"
setup() {
--
2.43.0