Open bessarabov opened 11 years ago
For now it is impossible to solve this issue without API change.
In the current version (1.0.0) you use Test::Whitespaces something like
use Test::Whitespaces {
dirs => [ 'lib', 'bin', 't' ],
};
but this issue is about creating new sub, lets call it get_fixed_whitespaces()
that will recieve $text
and will return the fixed version of that text. To use that sub you need to use Test::Whitespaces
, but use
in the current version also starts testing.
I think that Test::Whitespaces interface should be changed to something like:
In xt/whitespaces.t:
use Test::Whitespaces;
Test::Whitespaces::test_whitespaces (
{
dirs => [ 'lib', 'bin', 't' ],
};
);
In some Perl code:
use Test::Whitespaces;
my $fixed_text = get_fixed_whitespaces($text);
Here is the situation. In Perl script I create some text in scalar variable. Then I need to fix all that whitespaces problems in that scalar. Now i can save that variable to the tmp file, fix that file with the script
whiter
and then read that file. But it can't be called an elegant solution. I think that some public method should be added to the Test::Whitespaces to make it possible to simply fix scalar.