Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added some tests for SimpleServer constructor

  • Loading branch information...
commit 8708fa558262fda74fcd3ae8dca2c08ae90d783b 1 parent a62ac40
Alexei Znamensky authored

Showing 1 changed file with 20 additions and 33 deletions. Show diff stats Hide diff stats

  1. +20 33 t/03.param.t
53 t/03.param.t
... ... @@ -1,43 +1,30 @@
1   -use Test::More tests => 0;
2   -
3   -__DATA__
4   -
5   -use Net::LDAP::SimpleServer;
  1 +use Test::More tests => 3;
6 2
7 3 sub _check_param {
8   - eval { Net::LDAP::SimpleServer->new(@_) };
9   -}
10 4
11   -sub check_param_success {
12   - my $p = _check_param(@_);
13   - ok($p);
14   -}
  5 + #diag( join ',', @_ );
  6 + eval {
  7 + use Net::LDAP::SimpleServer;
  8 + my $s = Net::LDAP::SimpleServer->new(@_);
  9 + $s->run();
  10 + };
15 11
16   -sub check_param_failure {
17   - my $p = _check_param(@_);
18   - ok( not $p );
  12 + #diag( '$@ = ' . $@ );
  13 + return $@;
19 14 }
20 15
21   -diag("Testing parameters for the constructor\n");
22   -
23   -check_param_failure('name/of/a/file/that/will/never/ever/exist!');
24   -
25   -use File::HomeDir;
26   -use File::Spec::Functions qw(catfile);
  16 +sub check_failure {
  17 + ok( _check_param(@_) );
  18 +}
27 19
28   -my $cfgfile =
29   - catfile( home(), Net::Squid::Auth::Plugin::SimpleLDAP::DEFAULT_CONFIG_FILE );
  20 +diag('Testing the constructor params for SimpleServer');
30 21
31   -if ( -r $cfgfile ) {
32   - diag( "Using default cfg file: " . $cfgfile );
33   - check_param_success();
34   -}
35   -else {
36   - diag("Default cfg file not found");
37   - check_param_failure();
38   -}
  22 +check_failure();
  23 +check_failure( {} );
39 24
40   -#SKIP: {
41   -# skip "Not messing with your default configuration file", 1
42   -# if -r $cfgfile;
  25 +# Cannot test for non-existent configuration file right now
  26 +# because Net::Server calls exit() when that happens >:-\
  27 +#
  28 +#check_failure( { conf_file => 'examples/no/file.conf' } );
43 29
  30 +check_failure( { data => 'examples/test1.ldif' } );

0 comments on commit 8708fa5

Please sign in to comment.
Something went wrong with that request. Please try again.