diff options
Diffstat (limited to 'libtests')
-rw-r--r-- | libtests/bits.cc | 1 | ||||
-rw-r--r-- | libtests/buffer.cc | 1 | ||||
-rw-r--r-- | libtests/build.mk | 1 | ||||
-rw-r--r-- | libtests/flate.cc | 4 | ||||
-rw-r--r-- | libtests/md5.cc | 1 | ||||
-rw-r--r-- | libtests/pcre.cc | 3 | ||||
-rw-r--r-- | libtests/png_filter.cc | 5 | ||||
-rw-r--r-- | libtests/pointer_holder.cc | 1 | ||||
-rw-r--r-- | libtests/qexc.cc | 53 | ||||
-rw-r--r-- | libtests/qtest/buffer/buffer.out | 2 | ||||
-rw-r--r-- | libtests/qtest/qexc.test | 28 | ||||
-rw-r--r-- | libtests/qtest/qexc/test0.out | 2 | ||||
-rw-r--r-- | libtests/qtest/qexc/test1.out | 1 | ||||
-rw-r--r-- | libtests/qtest/qexc/test2.out | 2 | ||||
-rw-r--r-- | libtests/qtest/qutil/qutil.out | 10 | ||||
-rw-r--r-- | libtests/qutil.cc | 31 | ||||
-rw-r--r-- | libtests/rc4.cc | 1 |
17 files changed, 26 insertions, 121 deletions
diff --git a/libtests/bits.cc b/libtests/bits.cc index 89516ae6..b1857988 100644 --- a/libtests/bits.cc +++ b/libtests/bits.cc @@ -1,4 +1,3 @@ - #include <qpdf/BitStream.hh> #include <qpdf/BitWriter.hh> #include <qpdf/Pl_Buffer.hh> diff --git a/libtests/buffer.cc b/libtests/buffer.cc index 13d16b50..a359a6eb 100644 --- a/libtests/buffer.cc +++ b/libtests/buffer.cc @@ -1,4 +1,3 @@ - #include <qpdf/Pl_Buffer.hh> #include <qpdf/Pl_Count.hh> #include <qpdf/Pl_Discard.hh> diff --git a/libtests/build.mk b/libtests/build.mk index 4a58fcaa..4e2fe9be 100644 --- a/libtests/build.mk +++ b/libtests/build.mk @@ -9,7 +9,6 @@ BINS_libtests = \ pcre \ png_filter \ pointer_holder \ - qexc \ qutil \ rc4 diff --git a/libtests/flate.cc b/libtests/flate.cc index d05e7f92..dc65c565 100644 --- a/libtests/flate.cc +++ b/libtests/flate.cc @@ -105,9 +105,9 @@ int main(int argc, char* argv[]) { run(filename); } - catch (QEXC::General& e) + catch (std::exception& e) { - std::cout << e.unparse() << std::endl; + std::cout << e.what() << std::endl; } return 0; } diff --git a/libtests/md5.cc b/libtests/md5.cc index 1d33f9a6..9b1ae483 100644 --- a/libtests/md5.cc +++ b/libtests/md5.cc @@ -1,4 +1,3 @@ - #include <qpdf/MD5.hh> #include <qpdf/Pl_MD5.hh> #include <qpdf/Pl_Discard.hh> diff --git a/libtests/pcre.cc b/libtests/pcre.cc index 8ff7fba0..6ebec01e 100644 --- a/libtests/pcre.cc +++ b/libtests/pcre.cc @@ -1,4 +1,3 @@ - #include <qpdf/PCRE.hh> #include <iostream> #include <string.h> @@ -12,7 +11,7 @@ int main(int argc, char* argv[]) PCRE("^([\\p{L}]+)", PCRE_UTF8); std::cout << "1" << std::endl; } - catch (PCRE::Exception& e) + catch (std::exception& e) { std::cout << "0" << std::endl; } diff --git a/libtests/png_filter.cc b/libtests/png_filter.cc index a4b8a110..b735f338 100644 --- a/libtests/png_filter.cc +++ b/libtests/png_filter.cc @@ -1,4 +1,3 @@ - #include <qpdf/Pl_PNGFilter.hh> #include <qpdf/Pl_StdioFile.hh> @@ -79,9 +78,9 @@ int main(int argc, char* argv[]) { run(filename, encode, columns); } - catch (QEXC::General& e) + catch (std::exception& e) { - std::cout << e.unparse() << std::endl; + std::cout << e.what() << std::endl; } return 0; } diff --git a/libtests/pointer_holder.cc b/libtests/pointer_holder.cc index 9176df17..173a8266 100644 --- a/libtests/pointer_holder.cc +++ b/libtests/pointer_holder.cc @@ -1,4 +1,3 @@ - #include <qpdf/PointerHolder.hh> #include <iostream> diff --git a/libtests/qexc.cc b/libtests/qexc.cc deleted file mode 100644 index 6a89f68d..00000000 --- a/libtests/qexc.cc +++ /dev/null @@ -1,53 +0,0 @@ - -#include <qpdf/QEXC.hh> -#include <iostream> -#include <errno.h> -#include <stdlib.h> - -void f(int n) -{ - switch (n) - { - case 0: - throw QEXC::General("general exception"); - break; - - case 1: - throw QEXC::Internal("internal error"); - break; - - case 2: - throw QEXC::System("doing something", EINVAL); - break; - } -} - -int main(int argc, char* argv[]) -{ - if (argc != 2) - { - std::cerr << "usage: qexc n" << std::endl; - exit(2); - } - - try - { - f(atoi(argv[1])); - } - catch (QEXC::General& e) - { - std::cerr << "exception: " << e.unparse() << std::endl; - 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; -} diff --git a/libtests/qtest/buffer/buffer.out b/libtests/qtest/buffer/buffer.out index 9ee2b545..787a38ed 100644 --- a/libtests/qtest/buffer/buffer.out +++ b/libtests/qtest/buffer/buffer.out @@ -5,7 +5,7 @@ data: 1234567890abcdefghij count: 32 size: 11 data: qwertyuiop -INTERNAL ERROR: Pl_Buffer::getBuffer() called when not ready +Pl_Buffer::getBuffer() called when not ready size: 9 data: mooquack done diff --git a/libtests/qtest/qexc.test b/libtests/qtest/qexc.test deleted file mode 100644 index 350ceba8..00000000 --- a/libtests/qtest/qexc.test +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env perl - -require 5.008; -BEGIN { $^W = 1; } -use strict; - -chdir("qexc") or die "chdir qexc failed: $!\n"; - -require TestDriver; - -my $td = new TestDriver('qexc'); - -my @tests = - (['general exception', 2], - ['internal error', 3], - ['system exception', 2], - ); - -for (my $i = 0; $i < scalar(@tests); ++$i) -{ - $td->runtest($tests[$i]->[0], - {$td->COMMAND => "qexc $i"}, - {$td->FILE => "test$i.out", - $td->EXIT_STATUS => $tests[$i]->[1]}, - $td->NORMALIZE_NEWLINES); -} - -$td->report(scalar(@tests)); diff --git a/libtests/qtest/qexc/test0.out b/libtests/qtest/qexc/test0.out deleted file mode 100644 index 7a6dba88..00000000 --- a/libtests/qtest/qexc/test0.out +++ /dev/null @@ -1,2 +0,0 @@ -exception: general exception -what: general exception diff --git a/libtests/qtest/qexc/test1.out b/libtests/qtest/qexc/test1.out deleted file mode 100644 index cb18f40c..00000000 --- a/libtests/qtest/qexc/test1.out +++ /dev/null @@ -1 +0,0 @@ -uncaught exception: INTERNAL ERROR: internal error diff --git a/libtests/qtest/qexc/test2.out b/libtests/qtest/qexc/test2.out deleted file mode 100644 index 0f1994f7..00000000 --- a/libtests/qtest/qexc/test2.out +++ /dev/null @@ -1,2 +0,0 @@ -exception: doing something: Invalid argument -what: doing something: Invalid argument diff --git a/libtests/qtest/qutil/qutil.out b/libtests/qtest/qutil/qutil.out index f7af8903..a48e6266 100644 --- a/libtests/qtest/qutil/qutil.out +++ b/libtests/qtest/qutil/qutil.out @@ -4,11 +4,11 @@ 3.141590 3.142 1000.123000 -exception 1: INTERNAL ERROR: Util::int_to_string has been called with a padding value greater than its internal limit -exception 2: INTERNAL ERROR: Util::int_to_string has been called with a padding value greater than its internal limit -exception 3: INTERNAL ERROR: Util::int_to_string has been called with a padding value greater than its internal limit -exception 4: INTERNAL ERROR: Util::double_to_string has been called with a number and a decimal places specification that would break an internal limit -exception 5: INTERNAL ERROR: Util::double_to_string has been called with a number and a decimal places specification that would break an internal limit +exception 1: Util::int_to_string has been called with a padding value greater than its internal limit +exception 2: Util::int_to_string has been called with a padding value greater than its internal limit +exception 3: Util::int_to_string has been called with a padding value greater than its internal limit +exception 4: Util::double_to_string has been called with a number and a decimal places specification that would break an internal limit +exception 5: Util::double_to_string has been called with a number and a decimal places specification that would break an internal limit one 7 compare okay diff --git a/libtests/qutil.cc b/libtests/qutil.cc index 0dfa0277..d1c090fb 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -1,4 +1,3 @@ - #include <iostream> #include <stdio.h> #include <sys/types.h> @@ -27,9 +26,9 @@ void string_conversion_test() // int_to_string bounds error std::cout << QUtil::int_to_string(1, 50) << std::endl; } - catch(QEXC::Internal &e) + catch (std::logic_error &e) { - std::cout << "exception 1: " << e.unparse() << std::endl; + std::cout << "exception 1: " << e.what() << std::endl; } try @@ -37,9 +36,9 @@ void string_conversion_test() // QUtil::int_to_string bounds error std::cout << QUtil::int_to_string(1, -50) << std::endl; } - catch(QEXC::Internal &e) + catch (std::logic_error& e) { - std::cout << "exception 2: " << e.unparse() << std::endl; + std::cout << "exception 2: " << e.what() << std::endl; } try @@ -47,9 +46,9 @@ void string_conversion_test() // QUtil::int_to_string bounds error std::cout << QUtil::int_to_string(-1, 49) << std::endl; } - catch(QEXC::Internal &e) + catch (std::logic_error& e) { - std::cout << "exception 3: " << e.unparse() << std::endl; + std::cout << "exception 3: " << e.what() << std::endl; } @@ -58,9 +57,9 @@ void string_conversion_test() // QUtil::double_to_string bounds error std::cout << QUtil::double_to_string(3.14159, 1024) << std::endl; } - catch(QEXC::Internal &e) + catch (std::logic_error& e) { - std::cout << "exception 4: " << e.unparse() << std::endl; + std::cout << "exception 4: " << e.what() << std::endl; } try @@ -68,9 +67,9 @@ void string_conversion_test() // QUtil::double_to_string bounds error std::cout << QUtil::double_to_string(1000.0, 95) << std::endl; } - catch(QEXC::Internal &e) + catch (std::logic_error& e) { - std::cout << "exception 5: " << e.unparse() << std::endl; + std::cout << "exception 5: " << e.what() << std::endl; } std::string embedded_null = "one"; @@ -101,9 +100,9 @@ void os_wrapper_test() std::cout << "after open" << std::endl; (void) close(fd); } - catch (QEXC::System& s) + catch (std::runtime_error& s) { - std::cout << "exception: " << s.unparse() << std::endl; + std::cout << "exception: " << s.what() << std::endl; } } @@ -118,9 +117,9 @@ void fopen_wrapper_test() std::cout << "after fopen" << std::endl; (void) fclose(f); } - catch (QEXC::System& s) + catch (std::runtime_error& s) { - std::cout << "exception: " << s.unparse() << std::endl; + std::cout << "exception: " << s.what() << std::endl; } } @@ -171,7 +170,7 @@ void to_utf8_test() { print_utf8(0x80000000UL); } - catch (QEXC::General& e) + catch (std::runtime_error& e) { std::cout << "0x80000000: " << e.what() << std::endl; } diff --git a/libtests/rc4.cc b/libtests/rc4.cc index 195740ec..8f809ec1 100644 --- a/libtests/rc4.cc +++ b/libtests/rc4.cc @@ -1,4 +1,3 @@ - #include <qpdf/Pl_RC4.hh> #include <qpdf/Pl_StdioFile.hh> |