Skip to content

Instantly share code, notes, and snippets.

@Songmu
Last active August 29, 2015 14:11
Show Gist options
  • Save Songmu/d4d6608a47103726aa10 to your computer and use it in GitHub Desktop.
Save Songmu/d4d6608a47103726aa10 to your computer and use it in GitHub Desktop.
package Hoge;
use strict;
use warnings;
use utf8;
use MyCon;
sub hage {
HOGE;
}
1;
package MyCon;
use strict;
use warnings;
use utf8;
use Const::Common (
HOGE => 'はげ',
);
1;
use strict;
use warnings;
use utf8;
use Test::More;
use Hoge;
use Test::Mock::Guard;
subtest 'orig' => sub {
is Hoge::hage, 'はげ';
};
subtest 'hagemaru' => sub {
my $g = mock_guard Hoge => {
hage => 'ハゲマル',
};
is Hoge::hage, 'ハゲマル';
};
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment