View Javadoc
1   /*
2    * Copyright (c) 2002-2025 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.javascript.host.intl;
16  
17  import org.apache.commons.lang3.CharUtils;
18  import org.htmlunit.WebDriverTestCase;
19  import org.htmlunit.junit.BrowserRunner;
20  import org.htmlunit.junit.annotation.Alerts;
21  import org.junit.ComparisonFailure;
22  import org.junit.Test;
23  import org.junit.runner.RunWith;
24  
25  /**
26   * Tests for {@link NumberFormat}.
27   *
28   * @author Ronald Brill
29   */
30  @RunWith(BrowserRunner.class)
31  public class NumberFormat2Test extends WebDriverTestCase {
32  
33      private void test(final String... string) throws Exception {
34          final StringBuilder html = new StringBuilder(DOCTYPE_HTML
35              + "<html><head>\n"
36              + "<script>\n"
37              + LOG_TEXTAREA_FUNCTION
38              + "  function test() {\n"
39              + "    var number = 31415.9265359;\n"
40              + "    try {\n");
41          for (int i = 0; i < string.length - 1; i++) {
42              html.append(string[i]).append("\n");
43          }
44          html.append(
45              "      log(" + string[string.length - 1] + ");\n"
46              + "    } catch(e) { logEx(e) }\n"
47              + "  }\n"
48              + "</script>\n"
49              + "</head><body onload='test()'>\n"
50              + LOG_TEXTAREA
51              + "</body></html>");
52  
53          try {
54              loadPageVerifyTextArea2(html.toString());
55          }
56          catch (final ComparisonFailure e) {
57              final String msg = e.getMessage();
58              for (int i = 0; i < msg.length(); i++) {
59                  final char c = msg.charAt(i);
60                  if (CharUtils.isAscii(c)) {
61                      System.out.print(c);
62                  }
63                  else {
64                      System.out.print(CharUtils.unicodeEscaped(c));
65                  }
66              }
67              System.out.println();
68              throw e;
69          }
70      }
71  
72      /**
73       * @throws Exception if the test fails
74       */
75      @Test
76      @Alerts("[object Intl]")
77      public void intl() throws Exception {
78          test("Intl");
79      }
80  
81      /**
82       * @throws Exception if the test fails
83       */
84      @Test
85      @Alerts("0")
86      public void format_zero() throws Exception {
87          test("new Intl.NumberFormat('en').format(0)");
88      }
89  
90      /**
91       * @throws Exception if the test fails
92       */
93      @Test
94      @Alerts("7")
95      public void format_int() throws Exception {
96          test("new Intl.NumberFormat('en').format(7)");
97      }
98  
99      /**
100      * @throws Exception if the test fails
101      */
102     @Test
103     @Alerts("0.012")
104     public void format_zeroDot() throws Exception {
105         test("new Intl.NumberFormat('en').format(0.0123)");
106     }
107 
108     /**
109      * @throws Exception if the test fails
110      */
111     @Test
112     @Alerts("31,415.927")
113     public void format_default() throws Exception {
114         test("new Intl.NumberFormat().format(number)");
115     }
116 
117     /**
118      * @throws Exception if the test fails
119      */
120     @Test
121     @Alerts("31,415.927")
122     public void format_ja_jp_u_ca_japanese() throws Exception {
123         test("new Intl.NumberFormat('ja-JP-u-ca-japanese').format(number)");
124     }
125 
126     /**
127      * Test not supported locale.
128      *
129      * @throws Exception if the test fails
130      */
131     @Test
132     @Alerts("31,415.927")
133     public void format_ban() throws Exception {
134         test("new Intl.NumberFormat('ban').format(number)");
135     }
136 
137     /**
138      * @throws Exception if the test fails
139      */
140     @Test
141     @Alerts("31.415,927")
142     public void format_id() throws Exception {
143         test("new Intl.NumberFormat('id').format(number)");
144     }
145 
146     /**
147      * Test the fallback language, in this case {@code Indonesian}.
148      *
149      * @throws Exception if the test fails
150      */
151     @Test
152     @Alerts("31.415,927")
153     public void format_ban_id() throws Exception {
154         test("new Intl.NumberFormat(['ban', 'id']).format(number)");
155     }
156 
157     /**
158      * @throws Exception if the test fails
159      */
160     @Test
161     @Alerts(DEFAULT = "31,415.927",
162             FF_ESR = "\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
163     public void format_ar() throws Exception {
164         test("new Intl.NumberFormat('ar').format(number)");
165     }
166 
167     /**
168      * @throws Exception if the test fails
169      */
170     @Test
171     @Alerts("31,415.927")
172     public void format_ar_ae() throws Exception {
173         test("new Intl.NumberFormat('ar-AE').format(number)");
174     }
175 
176     /**
177      * @throws Exception if the test fails
178      */
179     @Test
180     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
181     public void format_ar_bh() throws Exception {
182         test("new Intl.NumberFormat('ar-BH').format(number)");
183     }
184 
185     /**
186      * @throws Exception if the test fails
187      */
188     @Test
189     @Alerts("31.415,927")
190     public void format_ar_dz() throws Exception {
191         test("new Intl.NumberFormat('ar-DZ').format(number)");
192     }
193 
194     /**
195      * @throws Exception if the test fails
196      */
197     @Test
198     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
199     public void format_ar_eg() throws Exception {
200         test("new Intl.NumberFormat('ar-EG').format(number)");
201     }
202 
203     /**
204      * @throws Exception if the test fails
205      */
206     @Test
207     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
208     public void format_ar_iq() throws Exception {
209         test("new Intl.NumberFormat('ar-IQ').format(number)");
210     }
211 
212     /**
213      * @throws Exception if the test fails
214      */
215     @Test
216     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
217     public void format_ar_jo() throws Exception {
218         test("new Intl.NumberFormat('ar-JO').format(number)");
219     }
220 
221     /**
222      * @throws Exception if the test fails
223      */
224     @Test
225     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
226     public void format_ar_kw() throws Exception {
227         test("new Intl.NumberFormat('ar-KW').format(number)");
228     }
229 
230     /**
231      * @throws Exception if the test fails
232      */
233     @Test
234     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
235     public void format_ar_lb() throws Exception {
236         test("new Intl.NumberFormat('ar-LB').format(number)");
237     }
238 
239     /**
240      * @throws Exception if the test fails
241      */
242     @Test
243     @Alerts("31.415,927")
244     public void format_ar_ly() throws Exception {
245         test("new Intl.NumberFormat('ar-LY').format(number)");
246     }
247 
248     /**
249      * @throws Exception if the test fails
250      */
251     @Test
252     @Alerts("31.415,927")
253     public void format_ar_ma() throws Exception {
254         test("new Intl.NumberFormat('ar-MA').format(number)");
255     }
256 
257     /**
258      * @throws Exception if the test fails
259      */
260     @Test
261     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
262     public void format_ar_om() throws Exception {
263         test("new Intl.NumberFormat('ar-OM').format(number)");
264     }
265 
266     /**
267      * @throws Exception if the test fails
268      */
269     @Test
270     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
271     public void format_ar_qa() throws Exception {
272         test("new Intl.NumberFormat('ar-QA').format(number)");
273     }
274 
275     /**
276      * @throws Exception if the test fails
277      */
278     @Test
279     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
280     public void format_ar_sa() throws Exception {
281         test("new Intl.NumberFormat('ar-SA').format(number)");
282     }
283 
284     /**
285      * @throws Exception if the test fails
286      */
287     @Test
288     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
289     public void format_ar_sd() throws Exception {
290         test("new Intl.NumberFormat('ar-SD').format(number)");
291     }
292 
293     /**
294      * @throws Exception if the test fails
295      */
296     @Test
297     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
298     public void format_ar_sy() throws Exception {
299         test("new Intl.NumberFormat('ar-SY').format(number)");
300     }
301 
302     /**
303      * @throws Exception if the test fails
304      */
305     @Test
306     @Alerts("31.415,927")
307     public void format_ar_tn() throws Exception {
308         test("new Intl.NumberFormat('ar-TN').format(number)");
309     }
310 
311     /**
312      * @throws Exception if the test fails
313      */
314     @Test
315     @Alerts("\u0663\u0661\u066c\u0664\u0661\u0665\u066b\u0669\u0662\u0667")
316     public void format_ar_ye() throws Exception {
317         test("new Intl.NumberFormat('ar-YE').format(number)");
318     }
319 
320     /**
321      * @throws Exception if the test fails
322      */
323     @Test
324     @Alerts(DEFAULT = "31,415.927",
325             FF = "31\u00a0415,927",
326             FF_ESR = "31\u00a0415,927")
327     public void format_be() throws Exception {
328         test("new Intl.NumberFormat('be').format(number)");
329     }
330 
331     /**
332      * @throws Exception if the test fails
333      */
334     @Test
335     @Alerts(DEFAULT = "31,415.927",
336             FF = "31\u00a0415,927",
337             FF_ESR = "31\u00a0415,927")
338     public void format_be_by() throws Exception {
339         test("new Intl.NumberFormat('be-BY').format(number)");
340     }
341 
342     /**
343      * @throws Exception if the test fails
344      */
345     @Test
346     @Alerts("31\u00a0415,927")
347     public void format_bg() throws Exception {
348         test("new Intl.NumberFormat('bg').format(number)");
349     }
350 
351     /**
352      * @throws Exception if the test fails
353      */
354     @Test
355     @Alerts("31\u00a0415,927")
356     public void format_bg_bg() throws Exception {
357         test("new Intl.NumberFormat('bg-BG').format(number)");
358     }
359 
360     /**
361      * @throws Exception if the test fails
362      */
363     @Test
364     @Alerts("31.415,927")
365     public void format_ca() throws Exception {
366         test("new Intl.NumberFormat('ca').format(number)");
367     }
368 
369     /**
370      * @throws Exception if the test fails
371      */
372     @Test
373     @Alerts("31.415,927")
374     public void format_ca_es() throws Exception {
375         test("new Intl.NumberFormat('ca-ES').format(number)");
376     }
377 
378     /**
379      * @throws Exception if the test fails
380      */
381     @Test
382     @Alerts("31\u00a0415,927")
383     public void format_cs() throws Exception {
384         test("new Intl.NumberFormat('cs').format(number)");
385     }
386 
387     /**
388      * @throws Exception if the test fails
389      */
390     @Test
391     @Alerts("31\u00a0415,927")
392     public void format_cs_cz() throws Exception {
393         test("new Intl.NumberFormat('cs-CZ').format(number)");
394     }
395 
396     /**
397      * @throws Exception if the test fails
398      */
399     @Test
400     @Alerts("31.415,927")
401     public void format_da() throws Exception {
402         test("new Intl.NumberFormat('da').format(number)");
403     }
404 
405     /**
406      * @throws Exception if the test fails
407      */
408     @Test
409     @Alerts("31.415,927")
410     public void format_da_dk() throws Exception {
411         test("new Intl.NumberFormat('da-DK').format(number)");
412     }
413 
414     /**
415      * @throws Exception if the test fails
416      */
417     @Test
418     @Alerts("31.415,927")
419     public void format_de() throws Exception {
420         test("new Intl.NumberFormat('de').format(number)");
421     }
422 
423     /**
424      * @throws Exception if the test fails
425      */
426     @Test
427     @Alerts("31\u00a0415,927")
428     public void format_de_at() throws Exception {
429         test("new Intl.NumberFormat('de-AT').format(number)");
430     }
431 
432     /**
433      * @throws Exception if the test fails
434      */
435     @Test
436     @Alerts("31\u2019415.927")
437     public void format_de_ch() throws Exception {
438         test("new Intl.NumberFormat('de-CH').format(number)");
439     }
440 
441     /**
442      * @throws Exception if the test fails
443      */
444     @Test
445     @Alerts("31.415,927")
446     public void format_de_de() throws Exception {
447         test("new Intl.NumberFormat('de-DE').format(number)");
448     }
449 
450     /**
451      * @throws Exception if the test fails
452      */
453     @Test
454     @Alerts("31.415,927")
455     public void format_de_lu() throws Exception {
456         test("new Intl.NumberFormat('de-LU').format(number)");
457     }
458 
459     /**
460      * @throws Exception if the test fails
461      */
462     @Test
463     @Alerts("31.415,927")
464     public void format_el() throws Exception {
465         test("new Intl.NumberFormat('el').format(number)");
466     }
467 
468     /**
469      * @throws Exception if the test fails
470      */
471     @Test
472     @Alerts("31.415,927")
473     public void format_el_cy() throws Exception {
474         test("new Intl.NumberFormat('el-CY').format(number)");
475     }
476 
477     /**
478      * @throws Exception if the test fails
479      */
480     @Test
481     @Alerts("31.415,927")
482     public void format_el_gr() throws Exception {
483         test("new Intl.NumberFormat('el-GR').format(number)");
484     }
485 
486     /**
487      * @throws Exception if the test fails
488      */
489     @Test
490     @Alerts("31,415.927")
491     public void format_en() throws Exception {
492         test("new Intl.NumberFormat('en').format(number)");
493     }
494 
495     /**
496      * @throws Exception if the test fails
497      */
498     @Test
499     @Alerts("31,415.927")
500     public void format_en_au() throws Exception {
501         test("new Intl.NumberFormat('en-AU').format(number)");
502     }
503 
504     /**
505      * @throws Exception if the test fails
506      */
507     @Test
508     @Alerts("31,415.927")
509     public void format_en_ca() throws Exception {
510         test("new Intl.NumberFormat('en-CA').format(number)");
511     }
512 
513     /**
514      * @throws Exception if the test fails
515      */
516     @Test
517     @Alerts("31,415.927")
518     public void format_en_gb() throws Exception {
519         test("new Intl.NumberFormat('en-GB').format(number)");
520     }
521 
522     /**
523      * @throws Exception if the test fails
524      */
525     @Test
526     @Alerts("31,415.927")
527     public void format_en_ie() throws Exception {
528         test("new Intl.NumberFormat('en-IE').format(number)");
529     }
530 
531     /**
532      * @throws Exception if the test fails
533      */
534     @Test
535     @Alerts("31,415.927")
536     public void format_en_in() throws Exception {
537         test("new Intl.NumberFormat('en-IN').format(number)");
538     }
539 
540     /**
541      * @throws Exception if the test fails
542      */
543     @Test
544     @Alerts("31,415.927")
545     public void format_en_mt() throws Exception {
546         test("new Intl.NumberFormat('en-MT').format(number)");
547     }
548 
549     /**
550      * @throws Exception if the test fails
551      */
552     @Test
553     @Alerts("31,415.927")
554     public void format_en_nz() throws Exception {
555         test("new Intl.NumberFormat('en-NZ').format(number)");
556     }
557 
558     /**
559      * @throws Exception if the test fails
560      */
561     @Test
562     @Alerts("31,415.927")
563     public void format_en_ph() throws Exception {
564         test("new Intl.NumberFormat('en-PH').format(number)");
565     }
566 
567     /**
568      * @throws Exception if the test fails
569      */
570     @Test
571     @Alerts("31,415.927")
572     public void format_en_sg() throws Exception {
573         test("new Intl.NumberFormat('en-SG').format(number)");
574     }
575 
576     /**
577      * @throws Exception if the test fails
578      */
579     @Test
580     @Alerts("31,415.927")
581     public void format_en_us() throws Exception {
582         test("new Intl.NumberFormat('en-US').format(number)");
583     }
584 
585     /**
586      * @throws Exception if the test fails
587      */
588     @Test
589     @Alerts(DEFAULT = "31\u00a0415,927",
590             CHROME = "31,415.927",
591             EDGE = "31,415.927")
592     public void format_en_za() throws Exception {
593         test("new Intl.NumberFormat('en-ZA').format(number)");
594     }
595 
596     /**
597      * @throws Exception if the test fails
598      */
599     @Test
600     @Alerts("31.415,927")
601     public void format_es() throws Exception {
602         test("new Intl.NumberFormat('es').format(number)");
603     }
604 
605     /**
606      * @throws Exception if the test fails
607      */
608     @Test
609     @Alerts("31.415,927")
610     public void format_es_ar() throws Exception {
611         test("new Intl.NumberFormat('es-AR').format(number)");
612     }
613 
614     /**
615      * @throws Exception if the test fails
616      */
617     @Test
618     @Alerts("31.415,927")
619     public void format_es_bo() throws Exception {
620         test("new Intl.NumberFormat('es-BO').format(number)");
621     }
622 
623     /**
624      * @throws Exception if the test fails
625      */
626     @Test
627     @Alerts("31.415,927")
628     public void format_es_cl() throws Exception {
629         test("new Intl.NumberFormat('es-CL').format(number)");
630     }
631 
632     /**
633      * @throws Exception if the test fails
634      */
635     @Test
636     @Alerts("31.415,927")
637     public void format_es_co() throws Exception {
638         test("new Intl.NumberFormat('es-CO').format(number)");
639     }
640 
641     /**
642      * @throws Exception if the test fails
643      */
644     @Test
645     @Alerts("31\u00a0415,927")
646     public void format_es_cr() throws Exception {
647         test("new Intl.NumberFormat('es-CR').format(number)");
648     }
649 
650     /**
651      * @throws Exception if the test fails
652      */
653     @Test
654     @Alerts("31,415.927")
655     public void format_es_do() throws Exception {
656         test("new Intl.NumberFormat('es-DO').format(number)");
657     }
658 
659     /**
660      * @throws Exception if the test fails
661      */
662     @Test
663     @Alerts("31.415,927")
664     public void format_es_ec() throws Exception {
665         test("new Intl.NumberFormat('es-EC').format(number)");
666     }
667 
668     /**
669      * @throws Exception if the test fails
670      */
671     @Test
672     @Alerts("31.415,927")
673     public void format_es_es() throws Exception {
674         test("new Intl.NumberFormat('es-ES').format(number)");
675     }
676 
677     /**
678      * @throws Exception if the test fails
679      */
680     @Test
681     @Alerts("31,415.927")
682     public void format_es_gt() throws Exception {
683         test("new Intl.NumberFormat('es-GT').format(number)");
684     }
685 
686     /**
687      * @throws Exception if the test fails
688      */
689     @Test
690     @Alerts("31,415.927")
691     public void format_es_hn() throws Exception {
692         test("new Intl.NumberFormat('es-HN').format(number)");
693     }
694 
695     /**
696      * @throws Exception if the test fails
697      */
698     @Test
699     @Alerts("31,415.927")
700     public void format_es_mx() throws Exception {
701         test("new Intl.NumberFormat('es-MX').format(number)");
702     }
703 
704     /**
705      * @throws Exception if the test fails
706      */
707     @Test
708     @Alerts("31,415.927")
709     public void format_es_ni() throws Exception {
710         test("new Intl.NumberFormat('es-NI').format(number)");
711     }
712 
713     /**
714      * @throws Exception if the test fails
715      */
716     @Test
717     @Alerts("31,415.927")
718     public void format_es_pa() throws Exception {
719         test("new Intl.NumberFormat('es-PA').format(number)");
720     }
721 
722     /**
723      * @throws Exception if the test fails
724      */
725     @Test
726     @Alerts("31,415.927")
727     public void format_es_pe() throws Exception {
728         test("new Intl.NumberFormat('es-PE').format(number)");
729     }
730 
731     /**
732      * @throws Exception if the test fails
733      */
734     @Test
735     @Alerts("31,415.927")
736     public void format_es_pr() throws Exception {
737         test("new Intl.NumberFormat('es-PR').format(number)");
738     }
739 
740     /**
741      * @throws Exception if the test fails
742      */
743     @Test
744     @Alerts("31.415,927")
745     public void format_es_py() throws Exception {
746         test("new Intl.NumberFormat('es-PY').format(number)");
747     }
748 
749     /**
750      * @throws Exception if the test fails
751      */
752     @Test
753     @Alerts("31,415.927")
754     public void format_es_sv() throws Exception {
755         test("new Intl.NumberFormat('es-SV').format(number)");
756     }
757 
758     /**
759      * @throws Exception if the test fails
760      */
761     @Test
762     @Alerts("31,415.927")
763     public void format_es_us() throws Exception {
764         test("new Intl.NumberFormat('es-US').format(number)");
765     }
766 
767     /**
768      * @throws Exception if the test fails
769      */
770     @Test
771     @Alerts("31.415,927")
772     public void format_es_uy() throws Exception {
773         test("new Intl.NumberFormat('es-UY').format(number)");
774     }
775 
776     /**
777      * @throws Exception if the test fails
778      */
779     @Test
780     @Alerts("31.415,927")
781     public void format_es_ve() throws Exception {
782         test("new Intl.NumberFormat('es-VE').format(number)");
783     }
784 
785     /**
786      * @throws Exception if the test fails
787      */
788     @Test
789     @Alerts("31\u00a0415,927")
790     public void format_et() throws Exception {
791         test("new Intl.NumberFormat('et').format(number)");
792     }
793 
794     /**
795      * @throws Exception if the test fails
796      */
797     @Test
798     @Alerts("31\u00a0415,927")
799     public void format_et_ee() throws Exception {
800         test("new Intl.NumberFormat('et-EE').format(number)");
801     }
802 
803     /**
804      * @throws Exception if the test fails
805      */
806     @Test
807     @Alerts("31\u00a0415,927")
808     public void format_fi() throws Exception {
809         test("new Intl.NumberFormat('fi').format(number)");
810     }
811 
812     /**
813      * @throws Exception if the test fails
814      */
815     @Test
816     @Alerts("31\u00a0415,927")
817     public void format_fi_fi() throws Exception {
818         test("new Intl.NumberFormat('fi-FI').format(number)");
819     }
820 
821     /**
822      * @throws Exception if the test fails
823      */
824     @Test
825     @Alerts("31\u202f415,927")
826     public void format_fr() throws Exception {
827         test("new Intl.NumberFormat('fr').format(number)");
828     }
829 
830     /**
831      * @throws Exception if the test fails
832      */
833     @Test
834     @Alerts("31\u202f415,927")
835     public void format_fr_be() throws Exception {
836         test("new Intl.NumberFormat('fr-BE').format(number)");
837     }
838 
839     /**
840      * @throws Exception if the test fails
841      */
842     @Test
843     @Alerts("31\u00a0415,927")
844     public void format_fr_ca() throws Exception {
845         test("new Intl.NumberFormat('fr-CA').format(number)");
846     }
847 
848     /**
849      * @throws Exception if the test fails
850      */
851     @Test
852     @Alerts("31\u202f415,927")
853     public void format_fr_ch() throws Exception {
854         test("new Intl.NumberFormat('fr-CH').format(number)");
855     }
856 
857     /**
858      * @throws Exception if the test fails
859      */
860     @Test
861     @Alerts("31\u202f415,927")
862     public void format_fr_fr() throws Exception {
863         test("new Intl.NumberFormat('fr-FR').format(number)");
864     }
865 
866     /**
867      * @throws Exception if the test fails
868      */
869     @Test
870     @Alerts("31.415,927")
871     public void format_fr_lu() throws Exception {
872         test("new Intl.NumberFormat('fr-LU').format(number)");
873     }
874 
875     /**
876      * @throws Exception if the test fails
877      */
878     @Test
879     @Alerts("31,415.927")
880     public void format_ga() throws Exception {
881         test("new Intl.NumberFormat('ga').format(number)");
882     }
883 
884     /**
885      * @throws Exception if the test fails
886      */
887     @Test
888     @Alerts("31,415.927")
889     public void format_ga_ie() throws Exception {
890         test("new Intl.NumberFormat('ga-IE').format(number)");
891     }
892 
893     /**
894      * @throws Exception if the test fails
895      */
896     @Test
897     @Alerts("31,415.927")
898     public void format_hi_in() throws Exception {
899         test("new Intl.NumberFormat('hi-IN').format(number)");
900     }
901 
902     /**
903      * @throws Exception if the test fails
904      */
905     @Test
906     @Alerts("31.415,927")
907     public void format_hr() throws Exception {
908         test("new Intl.NumberFormat('hr').format(number)");
909     }
910 
911     /**
912      * @throws Exception if the test fails
913      */
914     @Test
915     @Alerts("31.415,927")
916     public void format_hr_hr() throws Exception {
917         test("new Intl.NumberFormat('hr-HR').format(number)");
918     }
919 
920     /**
921      * @throws Exception if the test fails
922      */
923     @Test
924     @Alerts("31\u00a0415,927")
925     public void format_hu() throws Exception {
926         test("new Intl.NumberFormat('hu').format(number)");
927     }
928 
929     /**
930      * @throws Exception if the test fails
931      */
932     @Test
933     @Alerts("31\u00a0415,927")
934     public void format_hu_hu() throws Exception {
935         test("new Intl.NumberFormat('hu-HU').format(number)");
936     }
937 
938     /**
939      * @throws Exception if the test fails
940      */
941     @Test
942     @Alerts("31.415,927")
943     public void format_in() throws Exception {
944         test("new Intl.NumberFormat('in').format(number)");
945     }
946 
947     /**
948      * @throws Exception if the test fails
949      */
950     @Test
951     @Alerts("31.415,927")
952     public void format_in_id() throws Exception {
953         test("new Intl.NumberFormat('in-ID').format(number)");
954     }
955 
956     /**
957      * @throws Exception if the test fails
958      */
959     @Test
960     @Alerts(DEFAULT = "31,415.927",
961             FF = "31.415,927",
962             FF_ESR = "31.415,927")
963     public void format_is() throws Exception {
964         test("new Intl.NumberFormat('is').format(number)");
965     }
966 
967     /**
968      * @throws Exception if the test fails
969      */
970     @Test
971     @Alerts(DEFAULT = "31,415.927",
972             FF = "31.415,927",
973             FF_ESR = "31.415,927")
974     public void format_is_is() throws Exception {
975         test("new Intl.NumberFormat('is-IS').format(number)");
976     }
977 
978     /**
979      * @throws Exception if the test fails
980      */
981     @Test
982     @Alerts("31.415,927")
983     public void format_it() throws Exception {
984         test("new Intl.NumberFormat('it').format(number)");
985     }
986 
987     /**
988      * @throws Exception if the test fails
989      */
990     @Test
991     @Alerts("31\u2019415.927")
992     public void format_it_ch() throws Exception {
993         test("new Intl.NumberFormat('it-CH').format(number)");
994     }
995 
996     /**
997      * @throws Exception if the test fails
998      */
999     @Test
1000     @Alerts("31.415,927")
1001     public void format_it_it() throws Exception {
1002         test("new Intl.NumberFormat('it-IT').format(number)");
1003     }
1004 
1005     /**
1006      * @throws Exception if the test fails
1007      */
1008     @Test
1009     @Alerts("31,415.927")
1010     public void format_iw() throws Exception {
1011         test("new Intl.NumberFormat('iw').format(number)");
1012     }
1013 
1014     /**
1015      * @throws Exception if the test fails
1016      */
1017     @Test
1018     @Alerts("31,415.927")
1019     public void format_iw_il() throws Exception {
1020         test("new Intl.NumberFormat('iw-IL').format(number)");
1021     }
1022 
1023     /**
1024      * @throws Exception if the test fails
1025      */
1026     @Test
1027     @Alerts("31,415.927")
1028     public void format_ja() throws Exception {
1029         test("new Intl.NumberFormat('ja').format(number)");
1030     }
1031 
1032     /**
1033      * @throws Exception if the test fails
1034      */
1035     @Test
1036     @Alerts("31,415.927")
1037     public void format_ja_jp() throws Exception {
1038         test("new Intl.NumberFormat('ja-JP').format(number)");
1039     }
1040 
1041     /**
1042      * @throws Exception if the test fails
1043      */
1044     @Test
1045     @Alerts("31,415.927")
1046     public void format_ko() throws Exception {
1047         test("new Intl.NumberFormat('ko').format(number)");
1048     }
1049 
1050     /**
1051      * @throws Exception if the test fails
1052      */
1053     @Test
1054     @Alerts("31,415.927")
1055     public void format_ko_kr() throws Exception {
1056         test("new Intl.NumberFormat('ko-KR').format(number)");
1057     }
1058 
1059     /**
1060      * @throws Exception if the test fails
1061      */
1062     @Test
1063     @Alerts("31\u00a0415,927")
1064     public void format_lt() throws Exception {
1065         test("new Intl.NumberFormat('lt').format(number)");
1066     }
1067 
1068     /**
1069      * @throws Exception if the test fails
1070      */
1071     @Test
1072     @Alerts("31\u00a0415,927")
1073     public void format_lt_lt() throws Exception {
1074         test("new Intl.NumberFormat('lt-LT').format(number)");
1075     }
1076 
1077     /**
1078      * @throws Exception if the test fails
1079      */
1080     @Test
1081     @Alerts("31\u00a0415,927")
1082     public void format_lv() throws Exception {
1083         test("new Intl.NumberFormat('lv').format(number)");
1084     }
1085 
1086     /**
1087      * @throws Exception if the test fails
1088      */
1089     @Test
1090     @Alerts("31\u00a0415,927")
1091     public void format_lv_lv() throws Exception {
1092         test("new Intl.NumberFormat('lv-LV').format(number)");
1093     }
1094 
1095     /**
1096      * @throws Exception if the test fails
1097      */
1098     @Test
1099     @Alerts(DEFAULT = "31,415.927",
1100             FF = "31.415,927",
1101             FF_ESR = "31.415,927")
1102     public void format_mk() throws Exception {
1103         test("new Intl.NumberFormat('mk').format(number)");
1104     }
1105 
1106     /**
1107      * @throws Exception if the test fails
1108      */
1109     @Test
1110     @Alerts(DEFAULT = "31,415.927",
1111             FF = "31.415,927",
1112             FF_ESR = "31.415,927")
1113     public void format_mk_mk() throws Exception {
1114         test("new Intl.NumberFormat('mk-MK').format(number)");
1115     }
1116 
1117     /**
1118      * @throws Exception if the test fails
1119      */
1120     @Test
1121     @Alerts("31,415.927")
1122     public void format_ms() throws Exception {
1123         test("new Intl.NumberFormat('ms').format(number)");
1124     }
1125 
1126     /**
1127      * @throws Exception if the test fails
1128      */
1129     @Test
1130     @Alerts("31,415.927")
1131     public void format_ms_my() throws Exception {
1132         test("new Intl.NumberFormat('ms-MY').format(number)");
1133     }
1134 
1135     /**
1136      * @throws Exception if the test fails
1137      */
1138     @Test
1139     @Alerts("31,415.927")
1140     public void format_mt() throws Exception {
1141         test("new Intl.NumberFormat('mt').format(number)");
1142     }
1143 
1144     /**
1145      * @throws Exception if the test fails
1146      */
1147     @Test
1148     @Alerts("31,415.927")
1149     public void format_mt_mt() throws Exception {
1150         test("new Intl.NumberFormat('mt-MT').format(number)");
1151     }
1152 
1153     /**
1154      * @throws Exception if the test fails
1155      */
1156     @Test
1157     @Alerts("31.415,927")
1158     public void format_nl() throws Exception {
1159         test("new Intl.NumberFormat('nl').format(number)");
1160     }
1161 
1162     /**
1163      * @throws Exception if the test fails
1164      */
1165     @Test
1166     @Alerts("31.415,927")
1167     public void format_nl_be() throws Exception {
1168         test("new Intl.NumberFormat('nl-BE').format(number)");
1169     }
1170 
1171     /**
1172      * @throws Exception if the test fails
1173      */
1174     @Test
1175     @Alerts("31.415,927")
1176     public void format_nl_nl() throws Exception {
1177         test("new Intl.NumberFormat('nl-NL').format(number)");
1178     }
1179 
1180     /**
1181      * @throws Exception if the test fails
1182      */
1183     @Test
1184     @Alerts("31\u00a0415,927")
1185     public void format_no() throws Exception {
1186         test("new Intl.NumberFormat('no').format(number)");
1187     }
1188 
1189     /**
1190      * @throws Exception if the test fails
1191      */
1192     @Test
1193     @Alerts("31\u00a0415,927")
1194     public void format_no_no() throws Exception {
1195         test("new Intl.NumberFormat('no-NO').format(number)");
1196     }
1197 
1198     /**
1199      * @throws Exception if the test fails
1200      */
1201     @Test
1202     @Alerts("RangeError")
1203     public void format_no_no_ny() throws Exception {
1204         test("new Intl.NumberFormat('no-NO-NY').format(number)");
1205     }
1206 
1207     /**
1208      * @throws Exception if the test fails
1209      */
1210     @Test
1211     @Alerts("31\u00a0415,927")
1212     public void format_pl() throws Exception {
1213         test("new Intl.NumberFormat('pl').format(number)");
1214     }
1215 
1216     /**
1217      * @throws Exception if the test fails
1218      */
1219     @Test
1220     @Alerts("31\u00a0415,927")
1221     public void format_pl_pl() throws Exception {
1222         test("new Intl.NumberFormat('pl-PL').format(number)");
1223     }
1224 
1225     /**
1226      * @throws Exception if the test fails
1227      */
1228     @Test
1229     @Alerts("31.415,927")
1230     public void format_pt() throws Exception {
1231         test("new Intl.NumberFormat('pt').format(number)");
1232     }
1233 
1234     /**
1235      * @throws Exception if the test fails
1236      */
1237     @Test
1238     @Alerts("31.415,927")
1239     public void format_pt_br() throws Exception {
1240         test("new Intl.NumberFormat('pt-BR').format(number)");
1241     }
1242 
1243     /**
1244      * @throws Exception if the test fails
1245      */
1246     @Test
1247     @Alerts("31\u00a0415,927")
1248     public void format_pt_pt() throws Exception {
1249         test("new Intl.NumberFormat('pt-PT').format(number)");
1250     }
1251 
1252     /**
1253      * @throws Exception if the test fails
1254      */
1255     @Test
1256     @Alerts("31.415,927")
1257     public void format_ro() throws Exception {
1258         test("new Intl.NumberFormat('ro').format(number)");
1259     }
1260 
1261     /**
1262      * @throws Exception if the test fails
1263      */
1264     @Test
1265     @Alerts("31.415,927")
1266     public void format_ro_ro() throws Exception {
1267         test("new Intl.NumberFormat('ro-RO').format(number)");
1268     }
1269 
1270     /**
1271      * @throws Exception if the test fails
1272      */
1273     @Test
1274     @Alerts("31\u00a0415,927")
1275     public void format_ru() throws Exception {
1276         test("new Intl.NumberFormat('ru').format(number)");
1277     }
1278 
1279     /**
1280      * @throws Exception if the test fails
1281      */
1282     @Test
1283     @Alerts("31\u00a0415,927")
1284     public void format_ru_ru() throws Exception {
1285         test("new Intl.NumberFormat('ru-RU').format(number)");
1286     }
1287 
1288     /**
1289      * @throws Exception if the test fails
1290      */
1291     @Test
1292     @Alerts("31\u00a0415,927")
1293     public void format_sk() throws Exception {
1294         test("new Intl.NumberFormat('sk').format(number)");
1295     }
1296 
1297     /**
1298      * @throws Exception if the test fails
1299      */
1300     @Test
1301     @Alerts("31\u00a0415,927")
1302     public void format_sk_sk() throws Exception {
1303         test("new Intl.NumberFormat('sk-SK').format(number)");
1304     }
1305 
1306     /**
1307      * @throws Exception if the test fails
1308      */
1309     @Test
1310     @Alerts("31.415,927")
1311     public void format_sl() throws Exception {
1312         test("new Intl.NumberFormat('sl').format(number)");
1313     }
1314 
1315     /**
1316      * @throws Exception if the test fails
1317      */
1318     @Test
1319     @Alerts("31.415,927")
1320     public void format_sl_si() throws Exception {
1321         test("new Intl.NumberFormat('sl-SI').format(number)");
1322     }
1323 
1324     /**
1325      * @throws Exception if the test fails
1326      */
1327     @Test
1328     @Alerts(DEFAULT = "31,415.927",
1329             EDGE = "31\u00a0415,927",
1330             FF = "31\u00a0415,927",
1331             FF_ESR = "31\u00a0415,927")
1332     public void format_sq() throws Exception {
1333         test("new Intl.NumberFormat('sq').format(number)");
1334     }
1335 
1336     /**
1337      * @throws Exception if the test fails
1338      */
1339     @Test
1340     @Alerts(DEFAULT = "31,415.927",
1341             EDGE = "31\u00a0415,927",
1342             FF = "31\u00a0415,927",
1343             FF_ESR = "31\u00a0415,927")
1344     public void format_sq_al() throws Exception {
1345         test("new Intl.NumberFormat('sq-AL').format(number)");
1346     }
1347 
1348     /**
1349      * @throws Exception if the test fails
1350      */
1351     @Test
1352     @Alerts("31.415,927")
1353     public void format_sr() throws Exception {
1354         test("new Intl.NumberFormat('sr').format(number)");
1355     }
1356 
1357     /**
1358      * @throws Exception if the test fails
1359      */
1360     @Test
1361     @Alerts("31.415,927")
1362     public void format_sr_ba() throws Exception {
1363         test("new Intl.NumberFormat('sr-BA').format(number)");
1364     }
1365 
1366     /**
1367      * @throws Exception if the test fails
1368      */
1369     @Test
1370     @Alerts("31.415,927")
1371     public void format_sr_cs() throws Exception {
1372         test("new Intl.NumberFormat('sr-CS').format(number)");
1373     }
1374 
1375     /**
1376      * @throws Exception if the test fails
1377      */
1378     @Test
1379     @Alerts("31.415,927")
1380     public void format_sr_me() throws Exception {
1381         test("new Intl.NumberFormat('sr-ME').format(number)");
1382     }
1383 
1384     /**
1385      * @throws Exception if the test fails
1386      */
1387     @Test
1388     @Alerts("31.415,927")
1389     public void format_sr_rs() throws Exception {
1390         test("new Intl.NumberFormat('sr-RS').format(number)");
1391     }
1392 
1393     /**
1394      * @throws Exception if the test fails
1395      */
1396     @Test
1397     @Alerts("31\u00a0415,927")
1398     public void format_sv() throws Exception {
1399         test("new Intl.NumberFormat('sv').format(number)");
1400     }
1401 
1402     /**
1403      * @throws Exception if the test fails
1404      */
1405     @Test
1406     @Alerts("31\u00a0415,927")
1407     public void format_sv_se() throws Exception {
1408         test("new Intl.NumberFormat('sv-SE').format(number)");
1409     }
1410 
1411     /**
1412      * @throws Exception if the test fails
1413      */
1414     @Test
1415     @Alerts("31,415.927")
1416     public void format_th() throws Exception {
1417         test("new Intl.NumberFormat('th').format(number)");
1418     }
1419 
1420     /**
1421      * @throws Exception if the test fails
1422      */
1423     @Test
1424     @Alerts("31,415.927")
1425     public void format_th_th() throws Exception {
1426         test("new Intl.NumberFormat('th-TH').format(number)");
1427     }
1428 
1429     /**
1430      * @throws Exception if the test fails
1431      */
1432     @Test
1433     @Alerts("31.415,927")
1434     public void format_tr() throws Exception {
1435         test("new Intl.NumberFormat('tr').format(number)");
1436     }
1437 
1438     /**
1439      * @throws Exception if the test fails
1440      */
1441     @Test
1442     @Alerts("31.415,927")
1443     public void format_tr_tr() throws Exception {
1444         test("new Intl.NumberFormat('tr-TR').format(number)");
1445     }
1446 
1447     /**
1448      * @throws Exception if the test fails
1449      */
1450     @Test
1451     @Alerts("31\u00a0415,927")
1452     public void format_uk() throws Exception {
1453         test("new Intl.NumberFormat('uk').format(number)");
1454     }
1455 
1456     /**
1457      * @throws Exception if the test fails
1458      */
1459     @Test
1460     @Alerts("31\u00a0415,927")
1461     public void format_uk_ua() throws Exception {
1462         test("new Intl.NumberFormat('uk-UA').format(number)");
1463     }
1464 
1465     /**
1466      * @throws Exception if the test fails
1467      */
1468     @Test
1469     @Alerts("31.415,927")
1470     public void format_vi() throws Exception {
1471         test("new Intl.NumberFormat('vi').format(number)");
1472     }
1473 
1474     /**
1475      * @throws Exception if the test fails
1476      */
1477     @Test
1478     @Alerts("31.415,927")
1479     public void format_vi_vn() throws Exception {
1480         test("new Intl.NumberFormat('vi-VN').format(number)");
1481     }
1482 
1483     /**
1484      * @throws Exception if the test fails
1485      */
1486     @Test
1487     @Alerts("31,415.927")
1488     public void format_zh() throws Exception {
1489         test("new Intl.NumberFormat('zh').format(number)");
1490     }
1491 
1492     /**
1493      * @throws Exception if the test fails
1494      */
1495     @Test
1496     @Alerts("31,415.927")
1497     public void format_zh_cn() throws Exception {
1498         test("new Intl.NumberFormat('zh-CN').format(number)");
1499     }
1500 
1501     /**
1502      * @throws Exception if the test fails
1503      */
1504     @Test
1505     @Alerts("31,415.927")
1506     public void format_zh_hk() throws Exception {
1507         test("new Intl.NumberFormat('zh-HK').format(number)");
1508     }
1509 
1510     /**
1511      * @throws Exception if the test fails
1512      */
1513     @Test
1514     @Alerts("31,415.927")
1515     public void format_zh_sg() throws Exception {
1516         test("new Intl.NumberFormat('zh-SG').format(number)");
1517     }
1518 
1519     /**
1520      * @throws Exception if the test fails
1521      */
1522     @Test
1523     @Alerts("31,415.927")
1524     public void format_zh_tw() throws Exception {
1525         test("new Intl.NumberFormat('zh-TW').format(number)");
1526     }
1527 }