VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/util/c-compress-test.pl@ 97851

最後變更 在這個檔案從97851是 94320,由 vboxsync 提交於 3 年 前

libs/openssl-3.0.1: Export to OSE and fix copyright headers in Makefiles, bugref:10128

檔案大小: 1.0 KB
 
1#! /usr/bin/env perl
2#
3# TEST c-compress-pl with a number of examples and what should happen to them
4
5use strict;
6use warnings;
7
8use File::Basename;
9
10my @pairs =
11 (
12 [ <<'_____'
13/* A hell of a program */
14#def\
15ine foo/* bar */ 3
16#define bar /* haha "A /* comment */ that should /* remain" */
17#define haha /* hoho */ "A /* comment */ that should /* remain" */
18
19int 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" */
28int main() {
29int x;
30}
31_____
32 ]
33 );
34
35my $here = dirname $0;
36my $c_compress = "$here/lang-compress.pl";
37
38use FileHandle;
39use IPC::Open2;
40use Text::Diff;
41foreach (@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}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette