@@ -9,167 +9,161 @@ import 'package:test/test.dart';
9
9
import 'utils.dart' ;
10
10
11
11
void main () {
12
- testWithFormatting ('Basic' , () {
13
- expect (
14
- Intl (
15
- locale: const Locale (language: 'en' , region: 'US' ),
16
- ).datetimeFormat ().format (DateTime .utc (2012 , 12 , 20 , 3 , 0 , 0 )),
17
- '12/20/2012' ,
18
- );
19
- }, tags: ['icu4xUnimplemented' ]);
12
+ testWithFormatting (
13
+ 'Basic' ,
14
+ () {
15
+ expect (
16
+ Intl (locale: const Locale (language: 'en' , region: 'US' ))
17
+ .datetimeFormat ()
18
+ .format (DateTime .utc (2012 , 12 , 20 , 3 , 0 , 0 )),
19
+ '12/20/2012' );
20
+ },
21
+ tags: ['icu4xUnimplemented' ],
22
+ );
20
23
21
- testWithFormatting ('timezone' , () {
22
- final date = DateTime .utc (2021 , 12 , 17 , 3 , 0 , 42 );
23
- final intl = Intl (locale: const Locale (language: 'en' , region: 'US' ));
24
- final timeZone = 'America/Los_Angeles' ;
25
- expect (
26
- intl
27
- .datetimeFormat (
28
- DateTimeFormatOptions (
24
+ testWithFormatting (
25
+ 'timezone' ,
26
+ () {
27
+ final date = DateTime .utc (2021 , 12 , 17 , 3 , 0 , 42 );
28
+ final intl = Intl (locale: const Locale (language: 'en' , region: 'US' ));
29
+ final timeZone = 'America/Los_Angeles' ;
30
+ expect (
31
+ intl
32
+ .datetimeFormat (DateTimeFormatOptions (
29
33
timeZone: timeZone,
30
34
timeZoneName: TimeZoneName .short,
31
- ),
32
- )
33
- .format (date),
34
- '12/16/2021, PST' ,
35
- );
36
- expect (
37
- intl
38
- .datetimeFormat (
39
- DateTimeFormatOptions (
35
+ ))
36
+ .format (date),
37
+ '12/16/2021, PST' ,
38
+ );
39
+ expect (
40
+ intl
41
+ .datetimeFormat (DateTimeFormatOptions (
40
42
timeZone: timeZone,
41
43
timeZoneName: TimeZoneName .long,
42
- ),
43
- )
44
- .format (date),
45
- '12/16/2021, Pacific Standard Time' ,
46
- );
47
- expect (
48
- intl
49
- .datetimeFormat (
50
- DateTimeFormatOptions (
44
+ ))
45
+ .format (date),
46
+ '12/16/2021, Pacific Standard Time' ,
47
+ );
48
+ expect (
49
+ intl
50
+ .datetimeFormat (DateTimeFormatOptions (
51
51
timeZone: timeZone,
52
52
timeZoneName: TimeZoneName .shortOffset,
53
- ),
54
- )
55
- .format (date),
56
- '12/16/2021, GMT-8' ,
57
- );
58
- expect (
59
- intl
60
- .datetimeFormat (
61
- DateTimeFormatOptions (
53
+ ))
54
+ .format (date),
55
+ '12/16/2021, GMT-8' ,
56
+ );
57
+ expect (
58
+ intl
59
+ .datetimeFormat (DateTimeFormatOptions (
62
60
timeZone: timeZone,
63
61
timeZoneName: TimeZoneName .longOffset,
64
- ),
65
- )
66
- .format (date),
67
- '12/16/2021, GMT-08:00' ,
68
- );
69
- expect (
70
- intl
71
- .datetimeFormat (
72
- DateTimeFormatOptions (
62
+ ))
63
+ .format (date),
64
+ '12/16/2021, GMT-08:00' ,
65
+ );
66
+ expect (
67
+ intl
68
+ .datetimeFormat (DateTimeFormatOptions (
73
69
timeZone: timeZone,
74
70
timeZoneName: TimeZoneName .shortGeneric,
75
- ),
76
- )
77
- .format (date),
78
- '12/16/2021, PT' ,
79
- );
80
- expect (
81
- intl
82
- .datetimeFormat (
83
- DateTimeFormatOptions (
71
+ ))
72
+ .format (date),
73
+ '12/16/2021, PT' ,
74
+ );
75
+ expect (
76
+ intl
77
+ .datetimeFormat (DateTimeFormatOptions (
84
78
timeZone: timeZone,
85
79
timeZoneName: TimeZoneName .longGeneric,
86
- ),
87
- )
88
- .format (date),
89
- '12/16/2021, Pacific Time' ,
90
- );
91
- }, tags: ['icu4xUnimplemented' ]);
80
+ ))
81
+ .format (date),
82
+ '12/16/2021, Pacific Time' ,
83
+ );
84
+ },
85
+ tags: ['icu4xUnimplemented' ],
86
+ );
92
87
93
- testWithFormatting ('day period' , () {
94
- final date = DateTime .utc (2021 , 12 , 17 , 4 , 0 , 42 );
95
- expect (
96
- Intl (locale: const Locale (language: 'en' , region: 'GB' ))
97
- .datetimeFormat (
98
- const DateTimeFormatOptions (
99
- hour: TimeStyle .numeric,
100
- clockstyle: ClockStyle (is12Hour: true , startAtZero: false ),
101
- dayPeriod: DayPeriod .short,
102
- timeZone: 'UTC' ,
103
- ),
104
- )
105
- .format (date),
106
- '4 at night' ,
107
- );
88
+ testWithFormatting (
89
+ 'day period' ,
90
+ () {
91
+ final date = DateTime .utc (2021 , 12 , 17 , 4 , 0 , 42 );
92
+ expect (
93
+ Intl (locale: const Locale (language: 'en' , region: 'GB' ))
94
+ .datetimeFormat (const DateTimeFormatOptions (
95
+ hour: TimeStyle .numeric,
96
+ clockstyle: ClockStyle (
97
+ is12Hour: true ,
98
+ startAtZero: false ,
99
+ ),
100
+ dayPeriod: DayPeriod .short,
101
+ timeZone: 'UTC' ,
102
+ ))
103
+ .format (date),
104
+ '4 at night' );
108
105
109
- expect (
110
- Intl (locale: const Locale (language: 'fr' ))
111
- .datetimeFormat (
112
- const DateTimeFormatOptions (
113
- hour : TimeStyle .numeric,
114
- clockstyle : ClockStyle (is12Hour : true , startAtZero : false ) ,
115
- dayPeriod : DayPeriod .narrow ,
116
- timeZone : 'UTC' ,
117
- ) ,
118
- )
119
- . format (date),
120
- '4 mat.' ,
121
- );
106
+ expect (
107
+ Intl (locale: const Locale (language: 'fr' ))
108
+ .datetimeFormat ( const DateTimeFormatOptions (
109
+ hour : TimeStyle .numeric,
110
+ clockstyle : ClockStyle (
111
+ is12Hour : true ,
112
+ startAtZero : false ,
113
+ ) ,
114
+ dayPeriod : DayPeriod .narrow ,
115
+ timeZone : 'UTC' ,
116
+ ))
117
+ . format (date) ,
118
+ '4 mat.' );
122
119
123
- expect (
124
- Intl (locale: const Locale (language: 'fr' ))
125
- .datetimeFormat (
126
- const DateTimeFormatOptions (
127
- hour: TimeStyle .numeric,
128
- clockstyle: ClockStyle (is12Hour: true , startAtZero: false ),
129
- dayPeriod: DayPeriod .long,
130
- timeZone: 'UTC' ,
131
- ),
132
- )
133
- .format (date),
134
- '4 du matin' ,
135
- );
136
- }, tags: ['icu4xUnimplemented' ]);
120
+ expect (
121
+ Intl (locale: const Locale (language: 'fr' ))
122
+ .datetimeFormat (const DateTimeFormatOptions (
123
+ hour: TimeStyle .numeric,
124
+ clockstyle: ClockStyle (
125
+ is12Hour: true ,
126
+ startAtZero: false ,
127
+ ),
128
+ dayPeriod: DayPeriod .long,
129
+ timeZone: 'UTC' ,
130
+ ))
131
+ .format (date),
132
+ '4 du matin' );
133
+ },
134
+ tags: ['icu4xUnimplemented' ],
135
+ );
137
136
138
- testWithFormatting ('style' , () {
139
- final date = DateTime .utc (2021 , 12 , 17 , 4 , 0 , 42 );
140
- expect (
141
- Intl (locale: const Locale (language: 'en' ))
142
- .datetimeFormat (
143
- const DateTimeFormatOptions (
144
- timeFormatStyle: TimeFormatStyle .short,
145
- timeZone: 'UTC' ,
146
- ),
147
- )
148
- .format (date),
149
- '4:00 AM' ,
150
- );
151
- expect (
152
- Intl (locale: const Locale (language: 'en' ))
153
- .datetimeFormat (
154
- const DateTimeFormatOptions (
155
- dateFormatStyle: DateFormatStyle .short,
156
- timeZone: 'UTC' ,
157
- ),
158
- )
159
- .format (date),
160
- '12/17/21' ,
161
- );
162
- expect (
163
- Intl (locale: const Locale (language: 'en' ))
164
- .datetimeFormat (
165
- const DateTimeFormatOptions (
166
- timeFormatStyle: TimeFormatStyle .medium,
167
- dateFormatStyle: DateFormatStyle .short,
168
- timeZone: 'UTC' ,
169
- ),
170
- )
171
- .format (date),
172
- '12/17/21, 4:00:42 AM' ,
173
- );
174
- }, tags: ['icu4xUnimplemented' ]);
137
+ testWithFormatting (
138
+ 'style' ,
139
+ () {
140
+ final date = DateTime .utc (2021 , 12 , 17 , 4 , 0 , 42 );
141
+ expect (
142
+ Intl (locale: const Locale (language: 'en' ))
143
+ .datetimeFormat (const DateTimeFormatOptions (
144
+ timeFormatStyle: TimeFormatStyle .short,
145
+ timeZone: 'UTC' ,
146
+ ))
147
+ .format (date),
148
+ '4:00 AM' );
149
+ expect (
150
+ Intl (locale: const Locale (language: 'en' ))
151
+ .datetimeFormat (const DateTimeFormatOptions (
152
+ dateFormatStyle: DateFormatStyle .short,
153
+ timeZone: 'UTC' ,
154
+ ))
155
+ .format (date),
156
+ '12/17/21' );
157
+ expect (
158
+ Intl (locale: const Locale (language: 'en' ))
159
+ .datetimeFormat (const DateTimeFormatOptions (
160
+ timeFormatStyle: TimeFormatStyle .medium,
161
+ dateFormatStyle: DateFormatStyle .short,
162
+ timeZone: 'UTC' ,
163
+ ))
164
+ .format (date),
165
+ '12/17/21, 4:00:42 AM' );
166
+ },
167
+ tags: ['icu4xUnimplemented' ],
168
+ );
175
169
}
0 commit comments