2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

windows fixes; okay for modern compilers

git-svn-id: svn+q:///qpdf/trunk@685 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2009-07-15 04:01:52 +00:00
parent a1c0aaf03a
commit 86f2d3449c
2 changed files with 11 additions and 28 deletions

View File

@ -4,20 +4,6 @@
#include <errno.h>
#include <stdlib.h>
void do_terminate()
{
try
{
throw;
}
catch (std::exception& e)
{
std::cerr << "uncaught exception: " << e.what() << std::endl;
exit(3);
}
exit(4);
}
void f(int n)
{
switch (n)
@ -33,19 +19,11 @@ void f(int n)
case 2:
throw QEXC::System("doing something", EINVAL);
break;
case 3:
{
int a = -1;
new char[a];
}
break;
}
}
int main(int argc, char* argv[])
{
std::set_terminate(do_terminate);
if (argc != 2)
{
std::cerr << "usage: qexc n" << std::endl;
@ -62,5 +40,14 @@ int main(int argc, char* argv[])
std::cerr << "what: " << e.what() << std::endl;
exit(2);
}
catch (std::exception& e)
{
std::cerr << "uncaught exception: " << e.what() << std::endl;
exit(3);
}
catch (...)
{
exit(4);
}
return 0;
}

View File

@ -14,18 +14,14 @@ my @tests =
(['general exception', 2],
['internal error', 3],
['system exception', 2],
['library exception', 3, "uncaught exception: .+\n"], # fails on VC7?
);
for (my $i = 0; $i < scalar(@tests); ++$i)
{
my $output = +((-f "test$i.out")
? {$td->FILE => "test$i.out"}
: {$td->REGEXP => $tests[$i]->[2]});
$output->{$td->EXIT_STATUS} = $tests[$i]->[1];
$td->runtest($tests[$i]->[0],
{$td->COMMAND => "qexc $i"},
$output,
{$td->FILE => "test$i.out",
$td->EXIT_STATUS => $tests[$i]->[1]},
$td->NORMALIZE_NEWLINES);
}