Accepting request 640471 from devel:languages:perl:CPAN-T
- Created OBS-URL: https://build.opensuse.org/request/show/640471 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Test-Log-Log4perl?expand=0&rev=1
This commit is contained in:
109
perl-Test-Log-Log4perl.spec
Normal file
109
perl-Test-Log-Log4perl.spec
Normal file
@@ -0,0 +1,109 @@
|
||||
#
|
||||
# spec file for package perl-Test-Log-Log4perl
|
||||
#
|
||||
# Copyright (c) 2015 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-Log-Log4perl
|
||||
Version: 0.32
|
||||
Release: 0
|
||||
%define cpan_name Test-Log-Log4perl
|
||||
Summary: test log4perl
|
||||
License: Artistic-1.0 or GPL-1.0+
|
||||
Group: Development/Libraries/Perl
|
||||
Url: http://search.cpan.org/dist/Test-Log-Log4perl/
|
||||
Source: http://www.cpan.org/authors/id/C/CL/CLKAO/%{cpan_name}-%{version}.tar.gz
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: perl
|
||||
BuildRequires: perl-macros
|
||||
BuildRequires: perl(Log::Log4perl)
|
||||
BuildRequires: perl(Module::Install)
|
||||
BuildRequires: perl(Test::Exception)
|
||||
#BuildRequires: perl(inc::Module::Install)
|
||||
#BuildRequires: perl(JSON)
|
||||
#BuildRequires: perl(Log::Log4perl::Logger)
|
||||
#BuildRequires: perl(LWP::Simple)
|
||||
#BuildRequires: perl(Module::Build)
|
||||
#BuildRequires: perl(Module::Install::Base)
|
||||
#BuildRequires: perl(Parse::CPAN::Meta)
|
||||
#BuildRequires: perl(Test::Log::Log4perl)
|
||||
#BuildRequires: perl(YAML::Tiny)
|
||||
Requires: perl(Log::Log4perl)
|
||||
Requires: perl(Test::Exception)
|
||||
%{perl_requires}
|
||||
|
||||
%description
|
||||
This module can be used to test that you're logging the right thing with
|
||||
Log::Log4perl. It checks that we get what, and only what, we expect logged
|
||||
by your code.
|
||||
|
||||
The basic process is very simple. Within your test script you get one or
|
||||
more loggers from *Test::Log::Log4perl* with the 'get_logger' method just
|
||||
like you would with *Log::Log4perl*. You're going to use these loggers to
|
||||
declare what you think the code you're going to test should be logging.
|
||||
|
||||
# declare a bunch of test loggers
|
||||
my $tlogger = Test::Log::Log4perl->get_logger("Foo::Bar");
|
||||
|
||||
Then, for each test you want to do you need to start up the module.
|
||||
|
||||
# start the test
|
||||
Test::Log::Log4perl->start();
|
||||
|
||||
This diverts all subsequent attempts *Log::Log4perl* makes to log stuff and
|
||||
records them internally rather than passing them though to the Log4perl
|
||||
appenders as normal.
|
||||
|
||||
You then need to declare with the loggers we created earlier what we hope
|
||||
Log4perl will be asked to log. This is the same syntax as
|
||||
Test::Log::Log4perl uses, except if you want you can use regular
|
||||
expressions:
|
||||
|
||||
$tlogger->debug("fish");
|
||||
$tlogger->warn(qr/bar/);
|
||||
|
||||
You then need to run your code that you're testing.
|
||||
|
||||
# call some code that hopefully will call the log4perl methods
|
||||
# 'debug' with "fish" and 'warn' with something that contains 'bar'
|
||||
some_code();
|
||||
|
||||
We finally need to tell *Test::Log4Perl* that we're done and it should do
|
||||
the comparisons.
|
||||
|
||||
# start the test
|
||||
Test::Log::Log4perl->end("test name");
|
||||
|
||||
%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
|
||||
|
||||
%files -f %{name}.files
|
||||
%defattr(-,root,root,755)
|
||||
%doc Changes MYMETA.json MYMETA.yml README
|
||||
|
||||
%changelog
|
Reference in New Issue
Block a user