Last change
on this file since 98108 was 94320, checked in by vboxsync, 3 years ago |
libs/openssl-3.0.1: Export to OSE and fix copyright headers in Makefiles, bugref:10128
|
File size:
1.0 KB
|
Line | |
---|
1 | #! /usr/bin/env perl
|
---|
2 | #
|
---|
3 | # TEST c-compress-pl with a number of examples and what should happen to them
|
---|
4 |
|
---|
5 | use strict;
|
---|
6 | use warnings;
|
---|
7 |
|
---|
8 | use File::Basename;
|
---|
9 |
|
---|
10 | my @pairs =
|
---|
11 | (
|
---|
12 | [ <<'_____'
|
---|
13 | /* A hell of a program */
|
---|
14 | #def\
|
---|
15 | ine foo/* bar */ 3
|
---|
16 | #define bar /* haha "A /* comment */ that should /* remain" */
|
---|
17 | #define haha /* hoho */ "A /* comment */ that should /* remain" */
|
---|
18 |
|
---|
19 | int main() {
|
---|
20 | int x;
|
---|
21 | /* one lonely comment */
|
---|
22 | }
|
---|
23 | _____
|
---|
24 | , <<'_____'
|
---|
25 | #define foo 3
|
---|
26 | #define bar that should
|
---|
27 | #define haha "A /* comment */ that should /* remain" */
|
---|
28 | int main() {
|
---|
29 | int x;
|
---|
30 | }
|
---|
31 | _____
|
---|
32 | ]
|
---|
33 | );
|
---|
34 |
|
---|
35 | my $here = dirname $0;
|
---|
36 | my $c_compress = "$here/lang-compress.pl";
|
---|
37 |
|
---|
38 | use FileHandle;
|
---|
39 | use IPC::Open2;
|
---|
40 | use Text::Diff;
|
---|
41 | foreach (@pairs) {
|
---|
42 | my $source = $_->[0];
|
---|
43 | my $expected = $_->[1];
|
---|
44 | my $pid = open2(\*Reader, \*Writer, "perl $c_compress 'C'");
|
---|
45 | print Writer $source;
|
---|
46 | close Writer;
|
---|
47 |
|
---|
48 | local $/ = undef; # slurp
|
---|
49 | my $got = <Reader>;
|
---|
50 |
|
---|
51 | if ($got ne $expected) {
|
---|
52 | print "MISMATCH:\n", diff \$expected, \$got;
|
---|
53 | }
|
---|
54 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.