summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-06-15 23:21:48 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-06-15 23:21:48 (EDT)
commit314de454f5d59d3a04f21bd28dd412b60c11db1e (patch)
tree4fc5538f394e065c15d3e05d12c8eca617e69a7e
parent431473c45813ba9beb15d123d119fcb1dcd0a97c (diff)
tests/lib/ob_rfc822_mktime.sh: New file
-rwxr-xr-xtests/lib/ob_rfc822_mktime.sh41
-rw-r--r--tests/local.mk1
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/lib/ob_rfc822_mktime.sh b/tests/lib/ob_rfc822_mktime.sh
new file mode 100755
index 0000000..8a80ff0
--- /dev/null
+++ b/tests/lib/ob_rfc822_mktime.sh
@@ -0,0 +1,41 @@
+# Tests for ob_arch_is_concerned()
+#
+# Copyright (C) 2019 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_ 18
+
+tst()
+{
+ local in="${1}"
+ local out="${2}"
+ shift 2
+
+ is "${in} = ${out}" "$(ob_rfc822_mktime "${in}")" "${out}"
+}
+
+tst 'Wed, 31 Dec 1969 19:00:00 -0500' 0
+tst 'Wed, 31 Dec 1969 19:00:01 -0500' 1
+tst 'Wed, 01 Jan 1970 00:00:00 +0000' 0
+tst 'Mon, 28 Feb 1994 19:00:00 -0500' 762480000
+tst 'Fri, 01 Jul 2000 10:20:30 +0100' 962410830
diff --git a/tests/local.mk b/tests/local.mk
index 3b052b3..fb03756 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -6,6 +6,7 @@ TESTS = \
%reldir%/lib/ob_parse_changelog.sh \
%reldir%/lib/ob_parse_control.sh \
%reldir%/lib/ob_substvars.sh \
+ %reldir%/lib/ob_rfc822_mktime.sh \
%reldir%/exe/opkbuild_version.sh \
%reldir%/exe/ob-buildenv.sh \
%reldir%/exe/ob-unpacksource.sh \