6 use Function::Parameters;
8 fun actual_location_of_line_with($marker) {
9 seek DATA, 0, 0 or die "seek DATA: $!";
11 while (my $line = readline DATA) {
13 index($line, $marker) >= 0
19 fun test_loc($marker) {
20 my $expected = actual_location_of_line_with $marker;
21 defined $expected or die "$marker: something done fucked up";
22 my $got = (caller)[2];
23 is $got, $expected, "location of '$marker'";
27 test_loc 'LT torture begin';
34 test_loc 'LT torture A';
38 test_loc 'LT torture B';
42 test_loc 'LT torture C';
46 test_loc 'LT torture D';
50 test_loc 'LT torture end';
71 test_loc 'LT torture body';
76 @_ = ($r, ($x & $y) << 1);
141 test_loc 'LT torture boot';
147 }->(sub { my $n = shift; is $n, 2, '1 + 1 = 2' }, 1, 1);
150 local $TODO = 'line numbers all fucked up';
153 test_loc 'LX torture begin';
155 test_loc 'LX torture A';
156 @_ = ( do { test_loc 'LX torture A-post'; () },
157 do { test_loc 'LX torture B-pre'; () }, fun ($f) { test_loc 'LX torture B-pre';
158 test_loc 'LX torture B';
161 test_loc 'LX torture C';
164 test_loc 'LX torture D';
167 test_loc 'LX torture end';
182 test_loc 'LX torture body';
186 @_ = ($r, ($x & $y) << 1);
238 test_loc 'LX torture boot';
244 }->(fun ($n) { is $n, 2, '1 + 1 = 2' }, 1, 1);