@@ -126,16 +126,34 @@ fn fluent_number_style() {
126126 let num = FluentNumber :: new ( 0.2 , FluentNumberOptions :: default ( ) ) ;
127127 assert_eq ! ( num. as_string_basic( ) , "0.2" ) ;
128128
129- let opts = FluentNumberOptions {
129+ let mut opts = FluentNumberOptions {
130130 minimum_fraction_digits : Some ( 3 ) ,
131131 ..Default :: default ( )
132132 } ;
133133
134134 let num = FluentNumber :: new ( 0.2 , opts. clone ( ) ) ;
135135 assert_eq ! ( num. as_string_basic( ) , "0.200" ) ;
136136
137- let num = FluentNumber :: new ( 2.0 , opts) ;
137+ let num = FluentNumber :: new ( 2.0 , opts. clone ( ) ) ;
138138 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" ) ;
139157}
140158
141159#[ test]
0 commit comments