File tree Expand file tree Collapse file tree 1 file changed +0
-100
lines changed Expand file tree Collapse file tree 1 file changed +0
-100
lines changed Original file line number Diff line number Diff line change @@ -144,50 +144,9 @@ where
144144
145145#[ cfg( test) ]
146146mod tests {
147- use crate :: event:: format:: LogSource ;
148-
149147 use super :: * ;
150148 use serde:: { Deserialize , Serialize } ;
151149 use serde_json:: json;
152-
153- #[ test]
154- fn hierarchical_json_flattening_success ( ) {
155- let value = json ! ( { "a" : { "b" : { "e" : [ "a" , "b" ] } } } ) ;
156- let expected = json ! ( [ { "a_b_e" : "a" } , { "a_b_e" : "b" } ] ) ;
157- assert_eq ! (
158- flatten_json_body(
159- value,
160- None ,
161- None ,
162- None ,
163- crate :: metadata:: SchemaVersion :: V1 ,
164- false ,
165- & LogSource :: default ( )
166- )
167- . unwrap( ) ,
168- expected
169- ) ;
170- }
171-
172- #[ test]
173- fn hierarchical_json_flattening_failure ( ) {
174- let value = json ! ( { "a" : { "b" : { "c" : { "d" : { "e" : [ "a" , "b" ] } } } } } ) ;
175- let expected = json ! ( { "a_b_c_d_e" : [ "a" , "b" ] } ) ;
176- assert_eq ! (
177- flatten_json_body(
178- value,
179- None ,
180- None ,
181- None ,
182- crate :: metadata:: SchemaVersion :: V1 ,
183- false ,
184- & LogSource :: default ( )
185- )
186- . unwrap( ) ,
187- expected
188- ) ;
189- }
190-
191150 #[ derive( Serialize , Deserialize ) ]
192151 struct TestBool {
193152 #[ serde(
@@ -353,63 +312,4 @@ mod tests {
353312 flattened_json
354313 ) ;
355314 }
356-
357- #[ test]
358- fn arr_obj_with_nested_type_v1 ( ) {
359- let json = json ! ( [
360- {
361- "a" : 1 ,
362- "b" : "hello" ,
363- } ,
364- {
365- "a" : 1 ,
366- "b" : "hello" ,
367- } ,
368- {
369- "a" : 1 ,
370- "b" : "hello" ,
371- "c" : [ { "a" : 1 } ]
372- } ,
373- {
374- "a" : 1 ,
375- "b" : "hello" ,
376- "c" : [ { "a" : 1 , "b" : 2 } ]
377- } ,
378- ] ) ;
379- let flattened_json = flatten_json_body (
380- json,
381- None ,
382- None ,
383- None ,
384- SchemaVersion :: V1 ,
385- false ,
386- & crate :: event:: format:: LogSource :: default ( ) ,
387- )
388- . unwrap ( ) ;
389-
390- assert_eq ! (
391- json!( [
392- {
393- "a" : 1 ,
394- "b" : "hello" ,
395- } ,
396- {
397- "a" : 1 ,
398- "b" : "hello" ,
399- } ,
400- {
401- "a" : 1 ,
402- "b" : "hello" ,
403- "c_a" : 1 ,
404- } ,
405- {
406- "a" : 1 ,
407- "b" : "hello" ,
408- "c_a" : 1 ,
409- "c_b" : 2 ,
410- } ,
411- ] ) ,
412- flattened_json
413- ) ;
414- }
415315}
You can’t perform that action at this time.
0 commit comments