• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "locale_test.h"
2 
3 #if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
4 #  include <locale>
5 #  include <stdexcept>
6 
7 #  if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
8 using namespace std;
9 #  endif
10 
11 //
12 // tests implementation
13 //
messages_by_name()14 void LocaleTest::messages_by_name()
15 {
16   /*
17    * Check of the 22.1.1.2.7 standard point. Construction of a locale
18    * instance from a null pointer or an unknown name should result in
19    * a runtime_error exception.
20    */
21 #  if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
22 #    if defined (STLPORT) || !defined (__GNUC__)
23   try {
24     locale loc(locale::classic(), new messages_byname<char>(static_cast<char const*>(0)));
25     CPPUNIT_FAIL;
26   }
27   catch (runtime_error const& /* e */) {
28     //CPPUNIT_MESSAGE( e.what() );
29   }
30   catch (...) {
31     CPPUNIT_FAIL;
32   }
33 #    endif
34 
35   try {
36     locale loc(locale::classic(), new messages_byname<char>("yasli_language"));
37     CPPUNIT_FAIL;
38   }
39   catch (runtime_error const& /* e */) {
40     //CPPUNIT_MESSAGE( e.what() );
41   }
42   catch (...) {
43     CPPUNIT_FAIL;
44   }
45 
46   /*
47   try {
48     locale loc(locale::classic(), new messages_byname<char>(""));
49     CPPUNIT_FAIL;
50   }
51   catch (runtime_error const& e) {
52     CPPUNIT_MESSAGE( e.what() );
53   }
54   catch (...) {
55     CPPUNIT_FAIL;
56   }
57   */
58 
59 #    if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
60 #      if defined (STLPORT) || !defined (__GNUC__)
61   try {
62     locale loc(locale::classic(), new messages_byname<wchar_t>(static_cast<char const*>(0)));
63     CPPUNIT_FAIL;
64   }
65   catch (runtime_error const&) {
66   }
67   catch (...) {
68     CPPUNIT_FAIL;
69   }
70 #    endif
71 
72   try {
73     locale loc(locale::classic(), new messages_byname<wchar_t>("yasli_language"));
74     CPPUNIT_FAIL;
75   }
76   catch (runtime_error const&) {
77   }
78   catch (...) {
79     CPPUNIT_FAIL;
80   }
81 #    endif
82 #  endif
83 }
84 
85 #endif
86