|
| 1 | +// Generated by ReScript, PLEASE EDIT WITH CARE |
| 2 | + |
| 3 | +import * as Js_exn from "rescript/lib/es6/js_exn.js"; |
| 4 | +import * as Caml_option from "rescript/lib/es6/caml_option.js"; |
| 5 | +import * as Core__Option from "../../src/Core__Option.mjs"; |
| 6 | +import * as Intl__LocaleTest from "./Intl__LocaleTest.mjs"; |
| 7 | +import * as Caml_js_exceptions from "rescript/lib/es6/caml_js_exceptions.js"; |
| 8 | +import * as Intl__CollatorTest from "./Intl__CollatorTest.mjs"; |
| 9 | +import * as Intl__SegmenterTest from "./Intl__SegmenterTest.mjs"; |
| 10 | +import * as Intl__ListFormatTest from "./Intl__ListFormatTest.mjs"; |
| 11 | +import * as Intl__PluralRulesTest from "./Intl__PluralRulesTest.mjs"; |
| 12 | +import * as Intl__NumberFormatTest from "./Intl__NumberFormatTest.mjs"; |
| 13 | +import * as Intl__DateTimeFormatTest from "./Intl__DateTimeFormatTest.mjs"; |
| 14 | +import * as Intl__RelativeTimeFormatTest from "./Intl__RelativeTimeFormatTest.mjs"; |
| 15 | + |
| 16 | +console.log("---"); |
| 17 | + |
| 18 | +console.log("Intl"); |
| 19 | + |
| 20 | +console.log(Intl.getCanonicalLocales("EN-US")); |
| 21 | + |
| 22 | +console.log(Intl.getCanonicalLocales([ |
| 23 | + "EN-US", |
| 24 | + "Fr" |
| 25 | + ])); |
| 26 | + |
| 27 | +try { |
| 28 | + console.log(Intl.getCanonicalLocales("bloop")); |
| 29 | +} |
| 30 | +catch (raw_e){ |
| 31 | + var e = Caml_js_exceptions.internalToOCamlException(raw_e); |
| 32 | + if (e.RE_EXN_ID === Js_exn.$$Error) { |
| 33 | + console.error(e._1); |
| 34 | + } else { |
| 35 | + throw e; |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +try { |
| 40 | + console.log(Intl.supportedValuesOf("calendar")); |
| 41 | + console.log(Intl.supportedValuesOf("collation")); |
| 42 | + console.log(Intl.supportedValuesOf("currency")); |
| 43 | + console.log(Intl.supportedValuesOf("numberingSystem")); |
| 44 | + console.log(Intl.supportedValuesOf("timeZone")); |
| 45 | + console.log(Intl.supportedValuesOf("unit")); |
| 46 | +} |
| 47 | +catch (raw_e$1){ |
| 48 | + var e$1 = Caml_js_exceptions.internalToOCamlException(raw_e$1); |
| 49 | + if (e$1.RE_EXN_ID === Js_exn.$$Error) { |
| 50 | + console.error(e$1._1); |
| 51 | + } else { |
| 52 | + throw e$1; |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +try { |
| 57 | + Intl.supportedValuesOf("someInvalidKey"); |
| 58 | + console.error("Shouldn't have been hit"); |
| 59 | +} |
| 60 | +catch (raw_e$2){ |
| 61 | + var e$2 = Caml_js_exceptions.internalToOCamlException(raw_e$2); |
| 62 | + if (e$2.RE_EXN_ID === Js_exn.$$Error) { |
| 63 | + var e$3 = e$2._1; |
| 64 | + var message = Core__Option.map(e$3.message, (function (prim) { |
| 65 | + return prim.toLowerCase(); |
| 66 | + })); |
| 67 | + var exit = 0; |
| 68 | + if (message === "invalid key : someinvalidkey") { |
| 69 | + console.log("Caught expected error"); |
| 70 | + } else { |
| 71 | + exit = 1; |
| 72 | + } |
| 73 | + if (exit === 1) { |
| 74 | + console.warn("Unexpected error message: \"" + message + "\""); |
| 75 | + throw e$3; |
| 76 | + } |
| 77 | + |
| 78 | + } else { |
| 79 | + var e$4 = Caml_js_exceptions.as_js_exn(e$2); |
| 80 | + if (e$4 !== undefined) { |
| 81 | + throw Caml_option.valFromOption(e$4); |
| 82 | + } |
| 83 | + console.error("Unexpected error"); |
| 84 | + } |
| 85 | +} |
| 86 | + |
| 87 | +var _collator = Intl__CollatorTest._collator; |
| 88 | + |
| 89 | +var collator = Intl__CollatorTest.collator; |
| 90 | + |
| 91 | +var resolvedOptions = Intl__DateTimeFormatTest.resolvedOptions; |
| 92 | + |
| 93 | +var timeZone = Intl__DateTimeFormatTest.timeZone; |
| 94 | + |
| 95 | +var _locale = Intl__LocaleTest._locale; |
| 96 | + |
| 97 | +var locale = Intl__LocaleTest.locale; |
| 98 | + |
| 99 | +var currencyFormatter = Intl__NumberFormatTest.currencyFormatter; |
| 100 | + |
| 101 | +var roundingFormatter = Intl__NumberFormatTest.roundingFormatter; |
| 102 | + |
| 103 | +var groupingFormatter1 = Intl__NumberFormatTest.groupingFormatter1; |
| 104 | + |
| 105 | +var groupingFormatter2 = Intl__NumberFormatTest.groupingFormatter2; |
| 106 | + |
| 107 | +var sigFormatter = Intl__NumberFormatTest.sigFormatter; |
| 108 | + |
| 109 | +var options = Intl__NumberFormatTest.options; |
| 110 | + |
| 111 | +var _formatter = Intl__SegmenterTest._formatter; |
| 112 | + |
| 113 | +var formatter = Intl__SegmenterTest.formatter; |
| 114 | + |
| 115 | +var segments = Intl__SegmenterTest.segments; |
| 116 | + |
| 117 | +export { |
| 118 | + _collator , |
| 119 | + collator , |
| 120 | + resolvedOptions , |
| 121 | + timeZone , |
| 122 | + _locale , |
| 123 | + locale , |
| 124 | + currencyFormatter , |
| 125 | + roundingFormatter , |
| 126 | + groupingFormatter1 , |
| 127 | + groupingFormatter2 , |
| 128 | + sigFormatter , |
| 129 | + options , |
| 130 | + _formatter , |
| 131 | + formatter , |
| 132 | + segments , |
| 133 | +} |
| 134 | +/* Not a pure module */ |
0 commit comments