| 1 | #!/usr/bin/env perl |
| 2 | |
| 3 | my $outdir = shift; |
| 4 | open(my $tests, '>', "$outdir/tests") |
| 5 | or die "unable to open $outdir/tests: $!"; |
| 6 | open(my $expect, '>', "$outdir/expect") |
| 7 | or die "unable to open $outdir/expect: $!"; |
| 8 | |
| 9 | print $expect "# chainlint: $outdir/tests\n"; |
| 10 | |
| 11 | my $offset = 0; |
| 12 | for my $script (@ARGV) { |
| 13 | print $expect "# chainlint: $script\n"; |
| 14 | |
| 15 | open(my $expect_in, '<', "chainlint/$script.expect") |
| 16 | or die "unable to open chainlint/$script.expect: $!"; |
| 17 | while (<$expect_in>) { |
| 18 | s/^\d+/$& + $offset/e; |
| 19 | print $expect $_; |
| 20 | } |
| 21 | |
| 22 | open(my $test_in, '<', "chainlint/$script.test") |
| 23 | or die "unable to open chainlint/$script.test: $!"; |
| 24 | while (<$test_in>) { |
| 25 | /^# LINT: / and next; |
| 26 | print $tests $_; |
| 27 | $offset++; |
| 28 | } |
| 29 | } |