root/libswish3/trunk/src/t/SwishTestUtils.pm

Revision 2142, 511 bytes (checked in by karpet, 7 months ago)

add some tokenizer tests and (doh!) include tokenizer.c

Line 
1 package SwishTestUtils;
2
3 sub slurp {
4     my $file = shift;
5     local $/;
6     open( F, "<$file" ) or die "can't slurp $file: $!";
7     my $buf = <F>;
8     close(F);
9     return $buf;
10 }
11
12 sub run_lint_stderr {
13     my $file   = shift;
14     my $config = shift;
15     my $cmd
16         = $config
17         ? "./swish_lint -c test_configs/$config test_docs/$file"
18         : "./swish_lint test_docs/$file";
19     return run_get_stderr($cmd);
20
21 }
22
23 sub run_get_stderr {
24     my $cmd = shift;
25     return join( ' ', `$cmd 2>&1` );
26 }
27
28 1;
Note: See TracBrowser for help on using the browser.