Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix up __FILE__ and __LINE__ when running eval.
- Loading branch information
Rocky Bernstein
committed
Aug 5, 2012
1 parent
5ae5c97
commit 08cb7fa
Showing
7 changed files
with
66 additions
and
8 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,26 @@ | ||
#!/usr/bin/env perl | ||
use warnings; use strict; | ||
use rlib '.'; | ||
use Helper; | ||
no warnings 'redefine'; | ||
|
||
my $opts = { | ||
filter => sub{ | ||
my ($got_lines, $correct_lines) = @_; | ||
my @result = (); | ||
for my $line (split("\n", $got_lines)) { | ||
if ($line =~ /['"].*gcd.pl["']/) { | ||
$line =~ s/['"].*gcd.pl["']/"gcd.pl"/; | ||
} | ||
push @result, $line; | ||
} | ||
$got_lines = join("\n", @result) . "\n"; | ||
return ($got_lines, $correct_lines); | ||
}, | ||
run_opts => " --basename --no-highlight -nx" | ||
}; | ||
|
||
my $test_prog = File::Spec->catfile(dirname(__FILE__), qw(.. example gcd.pl)); | ||
use Test::More; | ||
Helper::run_debugger("$test_prog 3 5", '__FILE__.cmd', undef, $opts); | ||
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
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,4 @@ | ||
# Test that __FILE__ and __LINE__ are set properly in eval. | ||
eval __FILE__ | ||
eval __LINE__ | ||
q! |
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,4 @@ | ||
-- (gcd.pl:18) | ||
die sprintf "Need two integer arguments, got %d", scalar(@ARGV) unless | ||
$DB::D[0] = "gcd.pl" | ||
$DB::D[1] = 18 |