Skip to content

Commit

Permalink
add is now add_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed May 27, 2011
1 parent 57e0b36 commit a112366
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Data/TagHive.pm
Expand Up @@ -36,7 +36,7 @@ sub __differ {
return $x ne $y;
}

sub add {
sub add_tag {
my ($self, $tagstr) = @_;

my $state = $self->{state};
Expand Down
12 changes: 6 additions & 6 deletions t/taghive.t
Expand Up @@ -9,7 +9,7 @@ use Data::TagHive;

my $taghive = Data::TagHive->new;

$taghive->add('fauxbox.type:by-seat.seats:17');
$taghive->add_tag('fauxbox.type:by-seat.seats:17');

my @has = qw(
fauxbox
Expand All @@ -33,30 +33,30 @@ for my $str (@hasnt) {
}

{
my $error = exception { $taghive->add('fauxbox.type:by-usage') };
my $error = exception { $taghive->add_tag('fauxbox.type:by-usage') };
ok($error, "we can't add a tag with a conflicting value");
like($error, qr/conflict at \Qfauxbox.type\E\b/, "...we get expected error");
}

{
my $error = exception { $taghive->add('fauxbox.type:by-usage.seats:17') };
my $error = exception { $taghive->add_tag('fauxbox.type:by-usage.seats:17') };
ok($error, "we can't add a tag with a conflicting value");
like($error, qr/conflict at \Qfauxbox.type\E\b/, "...we get expected error");
}

{
my $error = exception { $taghive->add('fauxbox:foo'); };
my $error = exception { $taghive->add_tag('fauxbox:foo'); };
ok($error, "we can't add a tag with a value when there was no value");
like($error, qr/conflict at fauxbox\b/, "...we get expected error");
}

{
my $error = exception { $taghive->add('fauxbox.type.xyz'); };
my $error = exception { $taghive->add_tag('fauxbox.type.xyz'); };
ok($error, "can't add descend with no value where one is already present");
like($error, qr/conflict at \Qfauxbox.type\E\b/, "...we get expected error");
}

for my $method (qw(add has_tag)) {
for my $method (qw(add_tag has_tag)) {
my $error = exception { $taghive->$method('not a tag!'); };
ok($error, "can't pass invalid tag to $method");
like($error, qr/invalid tagstr/, "...we get expected error");
Expand Down

0 comments on commit a112366

Please sign in to comment.