icu-test-functions.json (8142B)
1 { 2 "Date and time formats": [ 3 { 4 "src": "Expires on {$exp}", 5 "exp": "Expires on 8/3/24, 9:43 PM", 6 "comment": "Modified from ICU4J copy to add params (likewise with the other date/time tests); 1722746637000 is 2024-08-03 21:43:57 PDT", 7 "params": {"exp": { "date": 1722746637000 } } 8 }, 9 { 10 "src": "Expires on {$exp :datetime}", 11 "exp": "Expires on 8/3/24, 9:43 PM", 12 "params": {"exp": { "date": 1722746637000 } } 13 }, 14 { 15 "src": "Expires on {$exp :datetime icu:skeleton=yMMMMdjmsSSEE}", 16 "exp": "Expires on Sat, August 3, 2024 at 9:43:57.00 PM", 17 "params": {"exp": { "date": 1722746637000 } }, 18 "ignoreTest": "ICU-22754 Skeleton option not implemented yet" 19 }, 20 { 21 "src": "Expires on {$exp :datetime dateStyle=full}", 22 "exp": "Expires on Saturday, August 3, 2024", 23 "params": {"exp": { "date": 1722746637000 } } 24 }, 25 { 26 "src": "Expires on {$exp :datetime dateStyle=long}", 27 "exp": "Expires on August 3, 2024", 28 "params": {"exp": { "date": 1722746637000 } } 29 }, 30 { 31 "src": "Expires on {$exp :datetime dateStyle=medium}", 32 "exp": "Expires on Aug 3, 2024", 33 "params": {"exp": { "date": 1722746637000 } } 34 }, 35 { 36 "src": "Expires on {$exp :datetime timeStyle=long}", 37 "exp": "Expires on 9:43:57 PM PDT", 38 "params": {"exp": { "date": 1722746637000 } } 39 }, 40 { 41 "src": "Expires on {$exp :datetime timeStyle=medium}", 42 "exp": "Expires on 9:43:57 PM", 43 "params": {"exp": { "date": 1722746637000 } } 44 }, 45 { 46 "src": "Expires on {$exp :datetime timeStyle=short}", 47 "exp": "Expires on 9:43 PM", 48 "params": {"exp": { "date": 1722746637000 } } 49 }, 50 { 51 "src": "Expires on {$exp :datetime dateStyle=full timeStyle=medium}", 52 "exp": "Expires on Saturday, August 3, 2024 at 9:43:57 PM", 53 "params": {"exp": { "date": 1722746637000 } } 54 }, 55 { 56 "src": "Expires on {$exp :datetime year=numeric month=long}", 57 "exp": "Expires on August 2024", 58 "params": {"exp": { "date": 1722746637000 } } 59 }, 60 { 61 "src": "Expires on {$exp :datetime year=numeric month=medium day=numeric weekday=long hour=numeric minute=numeric}", 62 "exp": "Expires on 3 Saturday 2024, 9:43 PM", 63 "params": {"exp": { "date": 1722746637000 } } 64 }, 65 { 66 "comment": "Make sure we ignore date / time fields if needed", 67 "src": "Expires on {$exp :date year=numeric month=medium day=numeric weekday=long hour=numeric minute=numeric}", 68 "exp": "Expires on 3 Saturday 2024", 69 "params": {"exp": { "date": 1722746637000 } }, 70 "ignoreTest": "ICU-22754 ICU4C doesn't accept field options for `:date` or `:time` -- see spec" 71 }, 72 { 73 "comment": "Make sure we ignore date / time fields if needed", 74 "src": "Expires at {$exp :time year=numeric month=medium day=numeric weekday=long hour=numeric minute=numeric}", 75 "exp": "Expires at 9:43 PM", 76 "params": {"exp": { "date": 1722746637000 } }, 77 "ignoreTest": "ICU-22754 ICU4C doesn't accept field options for `:date` or `:time` -- see spec" 78 }, 79 { 80 "comment": "Make sure we ignore date / time fields if needed", 81 "src": "Expires at {$exp :time style=long dateStyle=full timeStyle=medium}", 82 "exp": "Expires at 9:43:57 PM PDT", 83 "params": {"exp": { "date": 1722746637000 } } 84 }, 85 { 86 "comment": "Make sure we ignore date / time fields if needed", 87 "src": "Expires on {$exp :date style=long dateStyle=full timeStyle=medium}", 88 "exp": "Expires on August 3, 2024", 89 "params": {"exp": { "date": 1722746637000 } } 90 } 91 ], 92 "Literals" : [ 93 { 94 "src": "Expires on {|2025-02-27| :datetime dateStyle=full}", 95 "exp": "Expires on Thursday, February 27, 2025" 96 }, 97 { 98 "src": "Expires at {|2024-07-02T19:23:45| :datetime timeStyle=full}", 99 "exp": "Expires at 7:23:45 PM Pacific Daylight Time" 100 }, 101 { 102 "src": "Expires at {|2024-07-02T19:23:45.123| :datetime timeStyle=full}", 103 "exp": "Expires at 7:23:45 PM Pacific Daylight Time" 104 }, 105 { 106 "src": "Expires on {|2025-02-27T19:23:45| :datetime dateStyle=full}", 107 "exp": "Expires on Thursday, February 27, 2025" 108 }, 109 { 110 "src": "Expires at {|2024-07-02T19:23:45Z| :datetime timeStyle=long}", 111 "exp": "Expires at 7:23:45 PM GMT" 112 }, 113 { 114 "src": "Expires at {|2024-07-02T19:23:45+03:30| :datetime timeStyle=full}", 115 "exp": "Expires at 7:23:45 PM GMT+03:30" 116 } 117 ], 118 "Chaining" : [ 119 { 120 "comment": "Horibly long, but I really wanted to test multiple declarations with overrides, and you can't join strings in JSON", 121 "srcs": [ 122 ".input {$exp :datetime timeStyle=short}\n", 123 ".input {$user :string}\n", 124 ".local $longExp = {$exp :datetime dateStyle=long}\n", 125 ".local $zooExp = {$exp :datetime dateStyle=short timeStyle=$tsOver}\n", 126 "{{Hello John, you want '{$exp}', '{$longExp}', or '{$zooExp}' or even '{$exp :datetime dateStyle=full}'?}}" 127 ], 128 "exp": "Hello John, you want '9:43 PM', 'August 3, 2024 at 9:43 PM', or '8/3/24, 9:43:57 PM Pacific Daylight Time' or even 'Saturday, August 3, 2024 at 9:43 PM'?", 129 "params": {"exp": { "date": 1722746637000 }, "user": "John", "tsOver" : "long" }, 130 "ignoreTest": "ICU-22754 ICU4C doesn't implement this kind of function composition yet. See https://github.com/unicode-org/message-format-wg/issues/515" 131 }, 132 { 133 "srcs": [ 134 ".input {$exp :datetime year=numeric month=numeric day=|2-digit|}\n", 135 ".local $longExp = {$exp :datetime month=long weekday=long}\n", 136 "{{Expires on '{$exp}' ('{$longExp}').}}" 137 ], 138 "exp": "Expires on '8/03/2024' ('Saturday, August 03, 2024').", 139 "params": {"exp": { "date": 1722746637000 } } 140 } 141 ], 142 "Number formatter" : [ 143 { 144 "src": "Format {$val} number", 145 "params": { "val": 31 }, 146 "exp": "Format 31 number" 147 }, 148 { 149 "src": "Format {123456789.9876} number", 150 "locale": "en-IN", 151 "exp": "Format 12,34,56,789.9876 number", 152 "ignoreTest": "ICU-22754 No default formatting for numbers, so it's formatted as a literal string. Is this in the spec?" 153 }, 154 { 155 "src": "Format {|3.1416|} number", 156 "locale": "ar-AR-u-nu-latn", 157 "exp": "Format 3.1416 number" 158 }, 159 { 160 "src": "Format {|3.1416|} number", 161 "locale": "ar-AR-u-nu-arab", 162 "exp": "Format ٣٫١٤١٦ number", 163 "ignoreTest": "ICU-22754 No default formatting for numbers, so it's formatted as a literal string. Is this in the spec?" 164 }, 165 { 166 "src": "Format {3.1415926 :number}", 167 "exp": "Format 3.141593" 168 }, 169 { 170 "src": "Format {3.1415926 :number maximumFractionDigits=4}", 171 "exp": "Format 3.1416" 172 }, 173 { 174 "src": "Format {3 :number minimumFractionDigits=2}", 175 "exp": "Format 3.00" 176 }, 177 { 178 "src": "Format {3.2 :number minimumFractionDigits=2}", 179 "exp": "Format 3.20" 180 }, 181 { 182 "src": "Format {123456789.97531 :number maximumSignificantDigits=4}", 183 "exp": "Format 123,500,000" 184 }, 185 { 186 "src": "Format {3.1415926 :number}", 187 "exp": "Format 3.141593" 188 }, 189 { 190 "src": "Numbering system {123456 :number numberingSystem=deva}", 191 "exp": "Numbering system १२३,४५६" 192 }, 193 { 194 "src": "Percent {0.1416 :number style=percent}", 195 "exp": "Percent 14.16%" 196 }, 197 { 198 "src": "Scientific {123456789.97531 :number notation=scientific}", 199 "exp": "Scientific 1.234568E8" 200 }, 201 { 202 "src": "Engineering {123456789.97531 :number notation=engineering}", 203 "exp": "Engineering 123.45679E6" 204 }, 205 { 206 "src": "Compact {123456789.97531 :number notation=compact}", 207 "exp": "Compact 123M" 208 }, 209 { 210 "src": "Compact {123456789.97531 :number notation=compact compactDisplay=long}", 211 "exp": "Compact 123 million" 212 }, 213 { 214 "src": "Compact {123456789.97531 :number notation=compact compactDisplay=short}", 215 "exp": "Compact 123M" 216 } 217 ] 218 }