summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rwxr-xr-xtests/lib/ob_get_binary_parameter.sh8
-rwxr-xr-xtests/lib/ob_iso8601_gmtime.sh7
-rwxr-xr-xtests/lib/ob_reduce_deps.sh20
-rwxr-xr-xtests/lib/ob_rfc822_mktime.sh7
-rwxr-xr-xtests/lib/ob_touch_t_gmtime.sh46
5 files changed, 81 insertions, 7 deletions
diff --git a/tests/lib/ob_get_binary_parameter.sh b/tests/lib/ob_get_binary_parameter.sh
index 1ad8a32..c85c3ec 100755
--- a/tests/lib/ob_get_binary_parameter.sh
+++ b/tests/lib/ob_get_binary_parameter.sh
@@ -23,7 +23,7 @@ set -eu
. "${TOP_SRCDIR}/tests/aux/common.sh"
. "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}"
-plan_ 5
+plan_ 7
command_ok_ 'ob_init_package()' -- ob_init_package '..'
@@ -32,6 +32,10 @@ is 'foo Architecture' \
is 'foo Platform' \
"$(ob_get_binary_parameter 'foo' 'Platform')" 'all'
is 'bar Architecture' \
- "$(ob_get_binary_parameter 'bar' 'Architecture')" 'all'
+ "$(ob_get_binary_parameter 'bar' 'Architecture')" 'any'
is 'bar Platform' \
"$(ob_get_binary_parameter 'bar' 'Platform')" 'all'
+is 'baz-qux Architecture' \
+ "$(ob_get_binary_parameter 'baz-qux' 'Architecture')" 'all'
+is 'baz-qux Platform' \
+ "$(ob_get_binary_parameter 'baz-qux' 'Platform')" 'all'
diff --git a/tests/lib/ob_iso8601_gmtime.sh b/tests/lib/ob_iso8601_gmtime.sh
index 840b378..f9d0deb 100755
--- a/tests/lib/ob_iso8601_gmtime.sh
+++ b/tests/lib/ob_iso8601_gmtime.sh
@@ -1,4 +1,4 @@
-# Tests for ob_arch_is_concerned()
+# Tests for ob_iso8601_gmtime()
#
# Copyright (C) 2019 Patrick McDermott
#
@@ -23,7 +23,7 @@ set -eu
. "${TOP_SRCDIR}/tests/aux/common.sh"
. "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}"
-plan_ 7
+plan_ 10
tst()
{
@@ -40,4 +40,7 @@ tst 108123 '1970-01-02T06:02:03Z'
tst 41877296 '1971-04-30T16:34:56Z'
tst 762480000 '1994-03-01T00:00:00Z'
tst 962443230 '2000-07-01T09:20:30Z'
+tst 1607419408 '2020-12-08T09:23:28Z'
+tst 1609459199 '2020-12-31T23:59:59Z'
+tst 1609510819 '2021-01-01T14:20:19Z'
tst 2147483648 '2038-01-19T03:14:08Z'
diff --git a/tests/lib/ob_reduce_deps.sh b/tests/lib/ob_reduce_deps.sh
index b1e8609..72f32dd 100755
--- a/tests/lib/ob_reduce_deps.sh
+++ b/tests/lib/ob_reduce_deps.sh
@@ -22,7 +22,7 @@ set -eu
. "${TOP_SRCDIR}/tests/aux/tap-functions.sh"
. "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}"
-plan_ 11
+plan_ 13
# Normal and union AND-lists.
@@ -83,6 +83,15 @@ command_ok_ \
x'foo, bar' \
]
+command_ok_ \
+ 'NORMAL LIST "foo, bar,"' -- \
+ [ x"$(ob_reduce_deps \
+ -a 'amd64-linux-glibc' \
+ 'foo, bar,' \
+ )" = \
+ x'foo, bar' \
+ ]
+
# Normal OR-lists.
command_ok_ \
@@ -112,6 +121,15 @@ command_ok_ \
x'foo | bar' \
]
+command_ok_ \
+ 'NORMAL LIST "foo | bar |"' -- \
+ [ x"$(ob_reduce_deps \
+ -a 'amd64-linux-glibc' \
+ 'foo | bar |' \
+ )" = \
+ x'foo | bar' \
+ ]
+
# Normal and union AND-lists with arch specs.
command_ok_ \
diff --git a/tests/lib/ob_rfc822_mktime.sh b/tests/lib/ob_rfc822_mktime.sh
index f0ddcbc..e62e5a6 100755
--- a/tests/lib/ob_rfc822_mktime.sh
+++ b/tests/lib/ob_rfc822_mktime.sh
@@ -1,4 +1,4 @@
-# Tests for ob_arch_is_concerned()
+# Tests for ob_rfc822_mktime()
#
# Copyright (C) 2019 Patrick McDermott
#
@@ -23,7 +23,7 @@ set -eu
. "${TOP_SRCDIR}/tests/aux/common.sh"
. "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}"
-plan_ 7
+plan_ 10
tst()
{
@@ -40,4 +40,7 @@ tst 'Fri, 02 Jan 1970 01:02:03 -0500' 108123
tst 'Fri, 30 Apr 1971 12:34:56 -0400' 41877296
tst 'Mon, 28 Feb 1994 19:00:00 -0500' 762480000
tst 'Sat, 01 Jul 2000 10:20:30 +0100' 962443230
+tst 'Tue, 08 Dec 2020 04:23:28 -0500' 1607419408
+tst 'Thu, 31 Dec 2020 23:59:59 +0000' 1609459199
+tst 'Fri, 01 Jan 2021 09:20:19 -0500' 1609510819
tst 'Tue, 19 Jan 2038 03:14:08 +0000' 2147483648
diff --git a/tests/lib/ob_touch_t_gmtime.sh b/tests/lib/ob_touch_t_gmtime.sh
new file mode 100755
index 0000000..f7c481c
--- /dev/null
+++ b/tests/lib/ob_touch_t_gmtime.sh
@@ -0,0 +1,46 @@
+# Tests for ob_touch_t_gmtime()
+#
+# Copyright (C) 2019, 2021 Patrick McDermott
+#
+# This file is part of opkbuild.
+#
+# opkbuild is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# opkbuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with opkbuild. If not, see <http://www.gnu.org/licenses/>.
+
+set -eu
+
+. "${TOP_SRCDIR}/tests/aux/tap-functions.sh"
+. "${TOP_SRCDIR}/tests/aux/common.sh"
+. "${TOP_BUILDDIR}/lib/libopkbuild.${SHSOEXT}.${LIBOPKBUILD_SHSOVERSION}"
+
+plan_ 10
+
+tst()
+{
+ local in="${1}"
+ local out="${2}"
+ shift 2
+
+ is "${in} = ${out}" "$(ob_touch_t_gmtime "${in}")" "${out}"
+}
+
+tst 0 '197001010000.00'
+tst 1 '197001010000.01'
+tst 108123 '197001020602.03'
+tst 41877296 '197104301634.56'
+tst 762480000 '199403010000.00'
+tst 962443230 '200007010920.30'
+tst 1607419408 '202012080923.28'
+tst 1609459199 '202012312359.59'
+tst 1609510819 '202101011420.19'
+tst 2147483648 '203801190314.08'