]> git.pld-linux.org Git - SPECS.git/blob - perl-Test-use-ok.spec
SPECS updated Mon 29 Apr 22:05:02 CEST 2024
[SPECS.git] / perl-Test-use-ok.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # do not perform "make test"
4
5 %define pdir    Test
6 %define pnam    use-ok
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
9 Name:           perl-Test-use-ok
10 Version:        0.02
11 Release:        1
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
19 BuildArch:      noarch
20 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
21
22 %description
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.
26
27 That is, instead of writing this:
28
29     use_ok( 'Some::Module' );
30     use_ok( 'Other::Module' );
31
32 One should write this:
33
34     BEGIN { use_ok( 'Some::Module' ); }
35     BEGIN { use_ok( 'Other::Module' ); }
36
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.
40
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.
44
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.
49
50 Czyli zamiast pisania tak:
51
52     use_ok( 'Jakis::Modul' );
53     use_ok( 'Inny::Modul' );
54
55 Powinno pisać się tak:
56
57     BEGIN { use_ok( 'Jakis::Modul' ); }
58     BEGIN { use_ok( 'Inny::Modul' ); }
59
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.
63
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.
67
68 %prep
69 %setup -q -n %{pdir}-%{pnam}-%{version}
70
71 %build
72 %{__perl} Makefile.PL \
73         INSTALLDIRS=vendor
74 %{__make}
75
76 %{?with_tests:%{__make} test}
77
78 %install
79 rm -rf $RPM_BUILD_ROOT
80
81 %{__make} install \
82         DESTDIR=$RPM_BUILD_ROOT
83
84 %clean
85 rm -rf $RPM_BUILD_ROOT
86
87 %files
88 %defattr(644,root,root,755)
89 %{perl_vendorlib}/Test/use
90 %{perl_vendorlib}/ok.pm
91 %{_mandir}/man3/*
This page took 0.660017 seconds and 3 git commands to generate.