Commit 05af873c authored by matsduf's avatar matsduf
Browse files

Merge pull request #4 from mattias-p/v1.3.0

v1.3.0
parents def6a886 7acb0374
......@@ -12,7 +12,7 @@ my $builder = Module::Build->new(
'Test::Differences' => 0,
'Test::MockObject' => 0,
},
configure_requires => { 'Module::Build' => 0.42 },
configure_requires => { 'Module::Build' => 0.38 },
requires => {
'perl' => 5.014,
'DateTime' => 0,
......
......@@ -22,6 +22,8 @@ t/06-icann-name-server-type-2-ok.t
t/07-types.t
t/08-util.t
t/09-grammar.t
t/10-grammar-optional.t
t/11-grammar-name-server-section.t
t/boilerplate.t
t/iana-epp-rep-id.txt
t/manifest.t
......
......@@ -25,11 +25,17 @@ Version history
* v1.0.0 - Initial public release (2015-12-03)
* v1.1.0 - Updated public release (2016-01-08)
* v1.2.0 - Updated public release (2016-02-02)
* v1.3.0 - Updated public release (2016-02-26)
The v1.1.0 release primarily matches the updates to the PDT Whois TP and TCs in the version 2.9 document release. It also handles the issue with IDN in the v1.0.0 release and corrects found bugs.
The v1.2.0 release primarily matches the updates to the PDT Whois TP in the the version 2.10 document release. It also corrects found bugs.
The v1.3.0 release includes two updates of the PDT Whois TP that will be included in the next document release:
* If the Domain Status is "ok" then the fragment in the URL in the Domain Status field may be "ok" or "OK".
* If a field is empty (key is there, but no value) there may be one space character (U+0020) after the colon, i.e. trailing space is permitted.
Specification compatibility matrix
----------------------------------
Refer to this compatibility matrix when deciding which version of Whois Selftest
......@@ -38,19 +44,23 @@ Tool to use.
<table>
<tr>
<th>Whois Selftest Tool version</th>
<th>PDT Test Specifications</th>
<th>PDT Document Release</th>
</tr>
<tr>
<td>v1.0.0</td>
<td>v.2.8</td>
<td>2.8</td>
</tr>
<tr>
<td>v1.1.0</td>
<td>v.2.9</td>
<td>2.9</td>
</tr>
<tr>
<td>v1.2.0</td>
<td>v.2.10</td>
<td>2.10</td>
</tr>
<tr>
<td>v1.3.0</td>
<td>2.10 plus two updates described above</td>
</tr>
</table>
......
libwhois-selftest-tool-perl (1.3.0-1) unstable; urgency=low
[CHANGED REQUIREMENTS]
* Allow single trailing space after empty field
* Allow upper case "OK" in the fragment of the URL in the Domain Status field
[OTHER]
* Lower Module::Build version requirements
* Minor cleanups
-- Mattias Päivärinta <mattias.paivarinta@doxwork.com> Fri, 26 Feb 2016 16:00:00 +0100
libwhois-selftest-tool-perl (1.2.0-1) unstable; urgency=low
* Matches the updates to the PDT Whois TP in the version 2.10 document release
......
......@@ -4,7 +4,7 @@ use strict;
use warnings;
use 5.014;
use version; our $VERSION = qv( 1.2.0 );
use version; our $VERSION = qv( 1.3.0 );
=pod
......
......@@ -215,9 +215,6 @@ sub next_line {
# Strip trailing space
$line =~ s/( *)$//;
my $trail_space = $1;
if ( length $trail_space > 0 ) {
push @errors, sprintf( "line %d: trailing space not allowed", $self->{_line_no} );
}
# Match token type
my $token;
......@@ -251,6 +248,10 @@ sub next_line {
my @translations = split '/', ( $2 || '' );
my $value = $3;
if ( !defined $value ) {
$trail_space =~ s/ $//;
}
$token = 'field';
$token_value = [ $key, \@translations, $value ];
}
......@@ -265,6 +266,10 @@ sub next_line {
$token_value = $line;
}
if ( length $trail_space > 0 ) {
push @errors, sprintf( "line %d: trailing space not allowed", $self->{_line_no} );
}
$self->{_lookahead_line} = $line;
$self->{_lookahead} = [ $token, $token_value, \@errors ];
return;
......
......@@ -380,8 +380,13 @@ my %default_types;
}
if ( $value =~ /^([^ ]+) {1,9}https:\/\/icann\.org\/epp#(.+)$/o ) {
if ( exists $DOMAIN_STATUS_CODES{$1} && $1 eq $2 ) {
return ();
if ( exists $DOMAIN_STATUS_CODES{$1} ) {
if ( $1 eq $2 ) {
return ();
}
elsif ( $1 eq 'ok' && $2 eq 'OK' ) {
return ();
}
}
}
......
......@@ -50,8 +50,8 @@ sub extract_roid {
}
elsif ( $token eq 'roid line' ) {
ref $value eq 'ARRAY' or croak "'roid line' value expected to be arrayref";
defined $value->[0] or croak "'roid line' value expected to have roid at position 0";
defined $value->[1] or croak "'hostname' value expected to have roid at position 1";
defined $value->[0] or croak "'roid line' value expected to have roid at position 0";
defined $value->[1] or croak "'hostname' value expected to have roid at position 1";
my ( $roid, $hostname ) = @{$value};
my @errors;
push @errors, grep { $_ ne 'expected roid suffix to be a registered epp repo id' } $types->validate_type( 'roid', $roid );
......@@ -95,7 +95,8 @@ sub scrub_u_label {
);
defined $ascii or croak 'unexpected return value';
return lc( $ascii =~ s/\.?$//r );
$ascii =~ s/\.?$//;
return lc( $ascii );
}
1;
......@@ -242,7 +242,7 @@ sub _occurances {
return; # mismatch: field must not be present as a non-empty field
}
elsif ( $line_before == $line_after ) {
last; # successfully parsed zero lines, no need to do it again
last; # successfully parsed zero lines, no need to do it again
}
}
}
......@@ -429,7 +429,7 @@ sub _line {
return;
}
ref $errors eq 'ARRAY' or confess;
ref $errors eq 'ARRAY' or confess;
ref $token_value eq 'ARRAY' or confess;
my ( $field_key, $field_translations, $field_value ) = @$token_value;
......
......@@ -209,16 +209,38 @@ subtest 'Leading space' => sub {
};
subtest 'Trailing space' => sub {
plan tests => 4;
plan tests => 3;
my $lexer = PDT::TS::Whois::Lexer->new("Key: Value with trailing space \r\n");
my $lexer = PDT::TS::Whois::Lexer->new("Key: Value with trailing space \r\nKey: \r\nKey: \r\n");
my ($token, $value, $errors) = $lexer->peek_line();
is($token, 'field', 'Should recognize field with stripped value');
eq_or_diff($value, ['Key', [], 'Value with trailing space'], 'Should recognize field with stripped value');
is(scalar @$errors, 1, 'Should detect an error');
like($errors->[0], qr/trailing space/i, 'Should complain about trailing space');
$lexer->next_line();
subtest 'Strip field value' => sub {
plan tests => 4;
my ($token, $value, $errors) = $lexer->peek_line();
is($token, 'field', 'Should report correct token');
eq_or_diff($value, ['Key', [], 'Value with trailing space'], 'Should report correct token value');
is(scalar @$errors, 1, 'Should detect an error');
like($errors->[0], qr/trailing space/i, 'Should complain about trailing space');
$lexer->next_line();
};
subtest 'Empty field with single trailing space' => sub {
plan tests => 3;
my ($token, $value, $errors) = $lexer->peek_line();
is($token, 'field', 'Should report correct token');
eq_or_diff($value, ['Key', [], undef], 'Should report correct token value');
eq_or_diff($errors, [], 'Should report no error');
$lexer->next_line();
};
subtest 'Empty field with too much trailing space' => sub {
plan tests => 4;
my ($token, $value, $errors) = $lexer->peek_line();
is($token, 'field', 'Should report correct token');
eq_or_diff($value, ['Key', [], undef], 'Should report correct token value');
is(scalar @$errors, 1, 'Should detect an error');
like($errors->[0], qr/trailing space/i, 'Should complain about trailing space');
$lexer->next_line();
};
};
subtest 'Pattern matching' => sub {
......
......@@ -132,13 +132,16 @@ subtest 'token' => sub {
};
subtest 'domain status' => sub {
plan tests => 4;
plan tests => 7;
reject_ok 'undef' => 'domain status';
reject_ok 'empty' => 'domain status', '';
accept_ok 'ok https://icann.org/epp#ok' => 'domain status', 'ok https://icann.org/epp#ok';
reject_ok 'bad http://noticann.org/epp#bad' => 'domain status', 'bad http://noticann.org/epp#bad';
accept_ok 'ok https://icann.org/epp#ok' => 'domain status', 'ok https://icann.org/epp#ok';
accept_ok 'explicit exception for upper case OK' => 'domain status', 'ok https://icann.org/epp#OK';
accept_ok 'inactive https://icann.org/epp#inactive' => 'domain status', 'inactive https://icann.org/epp#inactive';
reject_ok 'inactive https://icann.org/epp#INACTIVE' => 'domain status', 'inactive https://icann.org/epp#INACTIVE';
reject_ok 'bad http://noticann.org/epp#bad' => 'domain status', 'bad http://noticann.org/epp#bad';
};
subtest 'postal line' => sub {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment