-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from nyrdz/main
Allow PPI::Statement::Expression in hash key
- Loading branch information
Showing
5 changed files
with
96 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use lib 't/lib'; | ||
|
||
use TestHelper qw( file2includes source2pi ); | ||
use Test::More import => [qw( done_testing is )]; | ||
use Test::Needs qw( HTTP::Status ); | ||
|
||
my @includes = file2includes('test-data/hash-key-expression.pl'); | ||
|
||
my $e = source2pi( | ||
'test-data/hash-key-expression.pl', undef, | ||
{ include => $includes[2] } | ||
); | ||
|
||
is( | ||
$e->formatted_ppi_statement, | ||
'use HTTP::Status qw( is_info );', | ||
'recognizes is_info as an imported symbol' | ||
); | ||
|
||
done_testing; |
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,25 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use lib 't/lib'; | ||
|
||
use TestHelper qw( file2includes source2pi ); | ||
use Test::More import => [qw( done_testing is )]; | ||
use Test::Needs qw( HTTP::Status ); | ||
|
||
my @includes = file2includes('test-data/hash-unquoted-key.pl'); | ||
|
||
my $e = source2pi( | ||
'test-data/hash-unquoted-key.pl', undef, | ||
{ include => $includes[2] } | ||
); | ||
|
||
is( | ||
$e->formatted_ppi_statement, | ||
'use HTTP::Status ();', | ||
'recognizes is_info as a word representing a string' | ||
); | ||
|
||
done_testing; |
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,8 @@ | ||
use strict; | ||
use warnings; | ||
|
||
use HTTP::Status qw(is_info); | ||
|
||
my %foo; | ||
my $code = 100; | ||
$foo{ is_info $code } = 'bar'; |
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,7 @@ | ||
use strict; | ||
use warnings; | ||
|
||
use HTTP::Status (); | ||
|
||
my %foo; | ||
$foo{is_info} = 1; |