File perl-Test-use-ok.spec of Package perl-Test-use-ok
#
# spec file for package perl-Test-use-ok
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Test-use-ok
Version: 0.02
Release: 1
License: GPL-1.0+ or Artistic-1.0
%define cpan_name Test-use-ok
Summary: Alternative to Test::More::use_ok
Url: http://search.cpan.org/dist/Test-use-ok/
Group: Development/Libraries/Perl
Source: http://www.cpan.org/authors/id/A/AU/AUDREYT/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(LWP::Simple)
BuildRequires: perl(Module::Build)
BuildRequires: perl(YAML)
%{perl_requires}
%description
According to the *Test::More* documentation, it is recommended to run
'use_ok()' inside a 'BEGIN' block, so functions are exported at
compile-time and prototypes are properly honored.
That is, instead of writing this:
use_ok( 'Some::Module' );
use_ok( 'Other::Module' );
One should write this:
BEGIN { use_ok( 'Some::Module' ); }
BEGIN { use_ok( 'Other::Module' ); }
However, people often either forget to add 'BEGIN', or mistakenly group
'use_ok' with other tests in a single 'BEGIN' block, which can create
subtle differences in execution order.
With this module, simply change all 'use_ok' in test scripts to 'use ok',
and they will be executed at 'BEGIN' time. The explicit space after 'use'
makes it clear that this is a single compile-time action.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%clean
%{__rm} -rf %{buildroot}
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README
%changelog