3 %bcond_without tests # do not perform "make test"
7 Summary: Test::use::ok - Alternative to Test::More::use_ok
8 Summary(pl.UTF-8): Test::use::ok - alternatywa dla Test::More::use_ok
12 License: GPL v1+ or Artistic
13 Group: Development/Languages/Perl
14 Source0: http://www.cpan.org/modules/by-authors/id/A/AU/AUDREYT/%{pdir}-%{pnam}-%{version}.tar.gz
15 # Source0-md5: c49b0bbb37a6764b8b96d9fcef954ba2
16 URL: http://search.cpan.org/dist/Test-use-ok/
17 BuildRequires: perl-devel >= 1:5.8.0
18 BuildRequires: rpm-perlprov >= 4.1-13
20 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
23 According to the Test::More documentation, it is recommended to run
24 use_ok() inside a BEGIN block, so functions are exported at
25 compile-time and prototypes are properly honored.
27 That is, instead of writing this:
29 use_ok( 'Some::Module' );
30 use_ok( 'Other::Module' );
32 One should write this:
34 BEGIN { use_ok( 'Some::Module' ); }
35 BEGIN { use_ok( 'Other::Module' ); }
37 However, people often either forget to add BEGIN, or mistakenly group
38 use_ok with other tests in a single BEGIN block, which can create
39 subtle differences in execution order.
41 With this module, simply change all use_ok in test scripts to use ok,
42 and they will be executed at BEGIN time. The explicit space after use
43 makes it clear that this is a single compile-time action.
45 %description -l pl.UTF-8
46 Zgodnie z dokumentacją Test::More, zaleca się wywoływanie use_ok()
47 wewnątrz bloku BEGIN, aby funkcje były eksportowane w czasie
48 kompilacji, a prototypy odpowiednio honorowane.
50 Czyli zamiast pisania tak:
52 use_ok( 'Jakis::Modul' );
53 use_ok( 'Inny::Modul' );
55 Powinno pisać się tak:
57 BEGIN { use_ok( 'Jakis::Modul' ); }
58 BEGIN { use_ok( 'Inny::Modul' ); }
60 Jednak ludzie często zapominają dodać BEGIN lub błędnie grupują use_ok
61 z innymi testami w pojedynczym bloku BEGIN, co może powodować subtelne
62 różnice w kolejności wykonywania.
64 Przy użyciu tego modułu wystarczy zmienić wszystkie use_ok w skryptach
65 testowych na use ok, i zostaną one wykonane w czasie BEGIN. Spacja po
66 use daje jasność, że jest to pojedyncza akcja w czasie kompilacji.
69 %setup -q -n %{pdir}-%{pnam}-%{version}
72 %{__perl} Makefile.PL \
76 %{?with_tests:%{__make} test}
79 rm -rf $RPM_BUILD_ROOT
82 DESTDIR=$RPM_BUILD_ROOT
85 rm -rf $RPM_BUILD_ROOT
88 %defattr(644,root,root,755)
89 %{perl_vendorlib}/Test/use
90 %{perl_vendorlib}/ok.pm