Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed class_to_file and class_to_path from Mojo::ByteStream again
- Loading branch information
Showing
4 changed files
with
41 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use Mojo::Base -strict; | ||
|
||
use Test::More tests => 20; | ||
|
||
# "If he is so smart, how come he is dead?" | ||
use Mojo::Util qw(class_to_file class_to_path get_line); | ||
|
||
# class_to_file | ||
is class_to_file('Foo::Bar'), 'foo_bar', 'right file'; | ||
is class_to_file('FooBar'), 'foo_bar', 'right file'; | ||
is class_to_file('FOOBar'), 'foobar', 'right file'; | ||
is class_to_file('FOOBAR'), 'foobar', 'right file'; | ||
is class_to_file('FOO::Bar'), 'foobar', 'right file'; | ||
is class_to_file('FooBAR'), 'foo_bar', 'right file'; | ||
is class_to_file('Foo::BAR'), 'foo_bar', 'right file'; | ||
|
||
# class_to_path | ||
is class_to_path('Foo::Bar'), 'Foo/Bar.pm', 'right path'; | ||
is class_to_path("Foo'Bar"), 'Foo/Bar.pm', 'right path'; | ||
is class_to_path("Foo'Bar::Baz"), 'Foo/Bar/Baz.pm', 'right path'; | ||
is class_to_path("Foo::Bar'Baz"), 'Foo/Bar/Baz.pm', 'right path'; | ||
is class_to_path("Foo::Bar::Baz"), 'Foo/Bar/Baz.pm', 'right path'; | ||
is class_to_path("Foo'Bar'Baz"), 'Foo/Bar/Baz.pm', 'right path'; | ||
|
||
# get_line | ||
my $buffer = "foo\x0d\x0abar\x0dbaz\x0ayada\x0d\x0a"; | ||
is get_line(\$buffer), 'foo', 'right line'; | ||
is $buffer, "bar\x0dbaz\x0ayada\x0d\x0a", 'right buffer content'; | ||
is get_line(\$buffer), "bar\x0dbaz", 'right line'; | ||
is $buffer, "yada\x0d\x0a", 'right buffer content'; | ||
is get_line(\$buffer), 'yada', 'right line'; | ||
is $buffer, '', 'no buffer content'; | ||
is get_line(\$buffer), undef, 'no line'; |