@@ -73,47 +73,6 @@ impl NowFunc {
7373 }
7474}
7575
76- #[ cfg( test) ]
77- mod tests {
78- use super :: * ;
79-
80- #[ allow( deprecated) ]
81- #[ test]
82- fn now_func_default_matches_config ( ) {
83- let default_config = ConfigOptions :: default ( ) ;
84-
85- let legacy_now = NowFunc :: new ( ) ;
86- let configured_now = NowFunc :: new_with_config ( & default_config) ;
87-
88- let empty_fields: [ FieldRef ; 0 ] = [ ] ;
89- let empty_scalars: [ Option < & ScalarValue > ; 0 ] = [ ] ;
90-
91- let legacy_field = legacy_now
92- . return_field_from_args ( ReturnFieldArgs {
93- arg_fields : & empty_fields,
94- scalar_arguments : & empty_scalars,
95- } )
96- . expect ( "legacy now() return field" ) ;
97-
98- let configured_field = configured_now
99- . return_field_from_args ( ReturnFieldArgs {
100- arg_fields : & empty_fields,
101- scalar_arguments : & empty_scalars,
102- } )
103- . expect ( "configured now() return field" ) ;
104-
105- assert_eq ! ( legacy_field. as_ref( ) , configured_field. as_ref( ) ) ;
106-
107- let legacy_scalar =
108- ScalarValue :: TimestampNanosecond ( None , legacy_now. timezone . clone ( ) ) ;
109- let configured_scalar =
110- ScalarValue :: TimestampNanosecond ( None , configured_now. timezone . clone ( ) ) ;
111-
112- assert_eq ! ( legacy_scalar, configured_scalar) ;
113- assert_eq ! ( Some ( "+00:00" ) , legacy_now. timezone. as_deref( ) ) ;
114- }
115- }
116-
11776/// Create an implementation of `now()` that always returns the
11877/// specified timestamp.
11978///
@@ -181,3 +140,44 @@ impl ScalarUDFImpl for NowFunc {
181140 self . doc ( )
182141 }
183142}
143+
144+ #[ cfg( test) ]
145+ mod tests {
146+ use super :: * ;
147+
148+ #[ allow( deprecated) ]
149+ #[ test]
150+ fn now_func_default_matches_config ( ) {
151+ let default_config = ConfigOptions :: default ( ) ;
152+
153+ let legacy_now = NowFunc :: new ( ) ;
154+ let configured_now = NowFunc :: new_with_config ( & default_config) ;
155+
156+ let empty_fields: [ FieldRef ; 0 ] = [ ] ;
157+ let empty_scalars: [ Option < & ScalarValue > ; 0 ] = [ ] ;
158+
159+ let legacy_field = legacy_now
160+ . return_field_from_args ( ReturnFieldArgs {
161+ arg_fields : & empty_fields,
162+ scalar_arguments : & empty_scalars,
163+ } )
164+ . expect ( "legacy now() return field" ) ;
165+
166+ let configured_field = configured_now
167+ . return_field_from_args ( ReturnFieldArgs {
168+ arg_fields : & empty_fields,
169+ scalar_arguments : & empty_scalars,
170+ } )
171+ . expect ( "configured now() return field" ) ;
172+
173+ assert_eq ! ( legacy_field. as_ref( ) , configured_field. as_ref( ) ) ;
174+
175+ let legacy_scalar =
176+ ScalarValue :: TimestampNanosecond ( None , legacy_now. timezone . clone ( ) ) ;
177+ let configured_scalar =
178+ ScalarValue :: TimestampNanosecond ( None , configured_now. timezone . clone ( ) ) ;
179+
180+ assert_eq ! ( legacy_scalar, configured_scalar) ;
181+ assert_eq ! ( Some ( "+00:00" ) , legacy_now. timezone. as_deref( ) ) ;
182+ }
183+ }
0 commit comments