~ubuntu-branches/ubuntu/trusty/xulrunner/trusty

« back to all changes in this revision

Viewing changes to intl/strres/tests/StringBundleTest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2008-08-25 13:04:18 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20080825130418-ck1i2ms384tzb9m0
Tags: 1.8.1.16+nobinonly-0ubuntu1
* New upstream release (taken from upstream CVS), LP: #254618.
* Fix MFSA 2008-35, MFSA 2008-34, MFSA 2008-33, MFSA 2008-32, MFSA 2008-31,
  MFSA 2008-30, MFSA 2008-29, MFSA 2008-28, MFSA 2008-27, MFSA 2008-25,
  MFSA 2008-24, MFSA 2008-23, MFSA 2008-22, MFSA 2008-21, MFSA 2008-26 also
  known as CVE-2008-2933, CVE-2008-2785, CVE-2008-2811, CVE-2008-2810,
  CVE-2008-2809, CVE-2008-2808, CVE-2008-2807, CVE-2008-2806, CVE-2008-2805,
  CVE-2008-2803, CVE-2008-2802, CVE-2008-2801, CVE-2008-2800, CVE-2008-2798.
* Drop 89_bz419350_attachment_306066 patch, merged upstream.
* Bump Standards-Version to 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
#include "nsIComponentManager.h"
54
54
//
55
55
#define TEST_URL "resource://gre/res/strres.properties"
 
56
#define TEST_397093_URL "resource://gre/res/397093.properties"
56
57
 
57
58
////////////////////////////////////////////////////////////////////////////////////////////////////
58
59
//
158
159
  value = ToNewCString(v);
159
160
  printf("file=\"%s\"\n", value);
160
161
 
 
162
  // Test for bug 397093
 
163
  nsIStringBundle* bundle397093 = nsnull;
 
164
 
 
165
  ret = service->CreateBundle(TEST_397093_URL, &bundle397093);
 
166
 
 
167
  if (NS_FAILED(ret)) {
 
168
    printf("cannot create bundle for 397093\n");
 
169
    return 1;
 
170
  }
 
171
 
 
172
  nsXPIDLString valueASCII, valueUTF8, valueLatin1;
 
173
  
 
174
  ret = bundle397093->GetStringFromName(NS_LITERAL_STRING("asciiProperty").get(),
 
175
                                  getter_Copies(valueASCII));
 
176
  if (NS_FAILED(ret)) {
 
177
    printf("failed to get string for asciiProperty\n");
 
178
    return 1;
 
179
  }
 
180
  if (!valueASCII.Equals(NS_LITERAL_STRING("Foo"))) {
 
181
    printf("incorrect value for asciiProperty\n");
 
182
    return 1;
 
183
  }
 
184
  
 
185
  ret = bundle397093->GetStringFromName(NS_LITERAL_STRING("utf8Property").get(),
 
186
                                  getter_Copies(valueUTF8));
 
187
  if (NS_FAILED(ret)) {
 
188
    printf("failed to get string for utf8Property\n");
 
189
    return 1;
 
190
  }
 
191
  if (!valueUTF8.Equals(NS_LITERAL_STRING("Fòò"))) {
 
192
    printf("incorrect value for utf8Property\n");
 
193
    return 1;
 
194
  }
 
195
 
 
196
  ret = bundle397093->GetStringFromName(NS_LITERAL_STRING("latin1Property").get(),
 
197
                                  getter_Copies(valueLatin1));
 
198
  if (NS_FAILED(ret)) {
 
199
    printf("failed to get string for latin1Property\n");
 
200
    return 1;
 
201
  }
 
202
  if (!valueLatin1.Equals(NS_LITERAL_STRING("F"))) {
 
203
    printf("incorrect value for latin1Property\n");
 
204
    return 1;
 
205
  }
 
206
  printf("test for bug 397093 passed\n");
 
207
 
161
208
  return 0;
162
209
}