@@ -126,16 +126,34 @@ fn fluent_number_style() {
126
126
let num = FluentNumber :: new ( 0.2 , FluentNumberOptions :: default ( ) ) ;
127
127
assert_eq ! ( num. as_string_basic( ) , "0.2" ) ;
128
128
129
- let opts = FluentNumberOptions {
129
+ let mut opts = FluentNumberOptions {
130
130
minimum_fraction_digits : Some ( 3 ) ,
131
131
..Default :: default ( )
132
132
} ;
133
133
134
134
let num = FluentNumber :: new ( 0.2 , opts. clone ( ) ) ;
135
135
assert_eq ! ( num. as_string_basic( ) , "0.200" ) ;
136
136
137
- let num = FluentNumber :: new ( 2.0 , opts) ;
137
+ let num = FluentNumber :: new ( 2.0 , opts. clone ( ) ) ;
138
138
assert_eq ! ( num. as_string_basic( ) , "2.000" ) ;
139
+
140
+ opts. minimum_integer_digits = Some ( 3 ) ;
141
+ opts. minimum_fraction_digits = None ;
142
+
143
+ let num = FluentNumber :: new ( 2.0 , opts. clone ( ) ) ;
144
+ assert_eq ! ( num. as_string_basic( ) , "002" ) ;
145
+
146
+ let num = FluentNumber :: new ( 0.2 , opts. clone ( ) ) ;
147
+ assert_eq ! ( num. as_string_basic( ) , "000.2" ) ;
148
+
149
+ opts. minimum_integer_digits = None ;
150
+ opts. maximum_significant_digits = Some ( 4 ) ;
151
+
152
+ let num = FluentNumber :: new ( 12345.0 , opts. clone ( ) ) ;
153
+ assert_eq ! ( num. as_string_basic( ) , "12340" ) ;
154
+
155
+ let num = FluentNumber :: new ( 1.2345 , opts) ;
156
+ assert_eq ! ( num. as_string_basic( ) , "1.234" ) ;
139
157
}
140
158
141
159
#[ test]
0 commit comments