Make a minor change to the format of the output

master
Koosha Khajeh Moogahi 2012-12-03 14:07:54 +03:30
parent 8faf48358c
commit 6e02789eaf
2 changed files with 4 additions and 4 deletions

View File

@ -35,12 +35,12 @@ handle remainder => sub {
return if $hex <= 0x1F || $hex >= 0x7F;
$string .= chr $hex;
}
$string =~ s/\n/ /g;
# Don't let long strings make the output untidy
if (length($string) > MAX_OUTPUT_LEN) {
$string = substr($string, 0, MAX_OUTPUT_LEN - 3) . '...';
}
return "ASCII: $string";
$string =~ s/\n/ /g;
return "$string (ASCII)";
}
return;
};

View File

@ -12,8 +12,8 @@ ddg_goodie_test(
[qw(
DDG::Goodie::HexToASCII
)],
'ascii 0x74657374' => test_zci('ASCII: test'),
'ascii 0x5468697320697320612074657374' => test_zci('ASCII: This is a test'),
'ascii 0x74657374' => test_zci('test (ASCII)'),
'ascii 0x5468697320697320612074657374' => test_zci('This is a test (ASCII)'),
);
done_testing;