diff --git a/perl-IO-HTML.spec b/perl-IO-HTML.spec
index e936845..d1ea35e 100644
--- a/perl-IO-HTML.spec
+++ b/perl-IO-HTML.spec
@@ -32,9 +32,23 @@ IO::HTML provides an easy way to open a file containing HTML while
automatically determining its encoding. It uses the HTML5 encoding sniffing
algorithm specified in section 8.2.2.1 of the draft standard.
+%package tests
+Summary: Tests for %{name}
+Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
+Requires: perl-Test-Harness
+
+%description tests
+Tests from %{name}. Execute them
+with "%{_libexecdir}/%{name}/test".
+
%prep
%setup -q -n IO-HTML-%{version}
%patch0 -p1
+# Help generators to recognize Perl scripts
+for F in t/*.t; do
+ perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' "$F"
+ chmod +x "$F"
+done
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
@@ -42,7 +56,16 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%install
%{make_install}
-%{_fixperms} $RPM_BUILD_ROOT/*
+# Install tests
+mkdir -p %{buildroot}%{_libexecdir}/%{name}
+cp -a t %{buildroot}%{_libexecdir}/%{name}
+cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
+#!/bin/sh
+cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
+EOF
+chmod +x %{buildroot}%{_libexecdir}/%{name}/test
+cp META.json %{buildroot}%{_libexecdir}/%{name}/
+%{_fixperms} %{buildroot}/*
%check
make test
@@ -53,8 +76,12 @@ make test
%{perl_vendorlib}/*
%{_mandir}/man3/*
+%files tests
+%{_libexecdir}/%{name}
+
%changelog
* Thu Oct 27 2022 Michal Josef Špaček - 1.004-8
+- Package tests
- Update license to SPDX format
* Fri Jul 22 2022 Fedora Release Engineering - 1.004-7