App-Sqitch
view release on metacpan or search on metacpan
name => 'howdy',
plan => $plan,
change => $change,
lspace => ' ',
rspace => "\t",
note => 'blah blah blah',
timestamp => $date,
planner_name => 'Barack Obama',
planner_email => 'potus@whitehouse.gov',
), 'Create tag with more stuff';
my $ts2 = '2012-07-16T17:25:07Z';
is $tag->as_string,
" \@howdy $ts2 Barack Obama <potus\@whitehouse.gov>\t# blah blah blah",
'It should as_string correctly';
$mock_plan->mock(index_of => 1);
$mock_plan->mock(change_at => $change);
is $tag->change, $change, 'Change should be correct';
is $tag->format_planner, 'Barack Obama <potus@whitehouse.gov>',
'Planner name and email should format properly';
# Make sure it gets the change even if there is a tag in between.
my @prevs = ($tag, $change);
$mock_plan->mock(index_of => 8);
$mock_plan->mock(change_at => sub { shift @prevs });
is $tag->change, $change, 'Change should be for previous change';
is $tag->info, join("\n",
'project sql',
'uri https://github.com/sqitchers/sqitch/',
'tag @howdy',
'change ' . $change->id,
'planner Barack Obama <potus@whitehouse.gov>',
'date 2012-07-16T17:25:07Z',
'', 'blah blah blah',
), 'Tag info should include the change';
is $tag->id, do {
my $content = $tag->info;
Digest::SHA->new(1)->add(
'tag ' . length($content) . "\0" . $content
)->hexdigest;
},'Tag ID should be correct';
##############################################################################
# Test ID for a tag with a UTF-8 name.
ok $tag = $CLASS->new(
name => 'é±éªé¬',
plan => $plan,
change => $change,
), 'Create tag with UTF-8 name';
is $tag->info, join("\n",
'project sql',
'uri https://github.com/sqitchers/sqitch/',
'tag ' . '@é±éªé¬',
'change ' . $change->id,
'planner ' . $tag->format_planner,
'date ' . $tag->timestamp->as_string,
), 'The name should be decoded text in info';
is $tag->id, do {
my $content = Encode::encode_utf8 $tag->info;
Digest::SHA->new(1)->add(
'tag ' . length($content) . "\0" . $content
)->hexdigest;
},'Tag ID should be hahsed from encoded UTF-8';
( run in 2.738 seconds using v1.01-cache-2.11-cpan-0d23b851a93 )