@@ -69,6 +69,9 @@ pub mod custom_attributes;
69
69
#[ cfg( test) ]
70
70
mod default_enum_value;
71
71
72
+ #[ cfg( test) ]
73
+ mod nesting;
74
+
72
75
mod test_enum_named_option_value {
73
76
include ! ( concat!( env!( "OUT_DIR" ) , "/myenum.optionn.rs" ) ) ;
74
77
}
@@ -91,10 +94,6 @@ pub mod foo {
91
94
}
92
95
}
93
96
94
- pub mod nesting {
95
- include ! ( concat!( env!( "OUT_DIR" ) , "/nesting.rs" ) ) ;
96
- }
97
-
98
97
pub mod recursive_oneof {
99
98
include ! ( concat!( env!( "OUT_DIR" ) , "/recursive_oneof.rs" ) ) ;
100
99
}
@@ -266,7 +265,7 @@ mod tests {
266
265
use alloc:: collections:: { BTreeMap , BTreeSet } ;
267
266
use alloc:: vec;
268
267
#[ cfg( not( feature = "std" ) ) ]
269
- use alloc:: { borrow :: ToOwned , boxed:: Box , string:: ToString } ;
268
+ use alloc:: { boxed:: Box , string:: ToString } ;
270
269
271
270
use super :: * ;
272
271
@@ -389,40 +388,6 @@ mod tests {
389
388
set2. insert ( msg2. field ) ;
390
389
}
391
390
392
- #[ test]
393
- fn test_nesting ( ) {
394
- use crate :: nesting:: { A , B } ;
395
- let _ = A {
396
- a : Some ( Box :: default ( ) ) ,
397
- repeated_a : Vec :: < A > :: new ( ) ,
398
- map_a : BTreeMap :: < i32 , A > :: new ( ) ,
399
- b : Some ( Box :: default ( ) ) ,
400
- repeated_b : Vec :: < B > :: new ( ) ,
401
- map_b : BTreeMap :: < i32 , B > :: new ( ) ,
402
- } ;
403
- }
404
-
405
- #[ test]
406
- fn test_deep_nesting ( ) {
407
- fn build_and_roundtrip ( depth : usize ) -> Result < ( ) , prost:: DecodeError > {
408
- use crate :: nesting:: A ;
409
-
410
- let mut a = Box :: < A > :: default ( ) ;
411
- for _ in 0 ..depth {
412
- let mut next = Box :: < A > :: default ( ) ;
413
- next. a = Some ( a) ;
414
- a = next;
415
- }
416
-
417
- let mut buf = Vec :: new ( ) ;
418
- a. encode ( & mut buf) . unwrap ( ) ;
419
- A :: decode ( buf. as_slice ( ) ) . map ( |_| ( ) )
420
- }
421
-
422
- assert ! ( build_and_roundtrip( 100 ) . is_ok( ) ) ;
423
- assert ! ( build_and_roundtrip( 101 ) . is_err( ) ) ;
424
- }
425
-
426
391
#[ test]
427
392
fn test_deep_nesting_oneof ( ) {
428
393
fn build_and_roundtrip ( depth : usize ) -> Result < ( ) , prost:: DecodeError > {
@@ -469,48 +434,6 @@ mod tests {
469
434
assert ! ( build_and_roundtrip( 51 ) . is_err( ) ) ;
470
435
}
471
436
472
- #[ test]
473
- fn test_deep_nesting_repeated ( ) {
474
- fn build_and_roundtrip ( depth : usize ) -> Result < ( ) , prost:: DecodeError > {
475
- use crate :: nesting:: C ;
476
-
477
- let mut c = C :: default ( ) ;
478
- for _ in 0 ..depth {
479
- let mut next = C :: default ( ) ;
480
- next. r . push ( c) ;
481
- c = next;
482
- }
483
-
484
- let mut buf = Vec :: new ( ) ;
485
- c. encode ( & mut buf) . unwrap ( ) ;
486
- C :: decode ( buf. as_slice ( ) ) . map ( |_| ( ) )
487
- }
488
-
489
- assert ! ( build_and_roundtrip( 100 ) . is_ok( ) ) ;
490
- assert ! ( build_and_roundtrip( 101 ) . is_err( ) ) ;
491
- }
492
-
493
- #[ test]
494
- fn test_deep_nesting_map ( ) {
495
- fn build_and_roundtrip ( depth : usize ) -> Result < ( ) , prost:: DecodeError > {
496
- use crate :: nesting:: D ;
497
-
498
- let mut d = D :: default ( ) ;
499
- for _ in 0 ..depth {
500
- let mut next = D :: default ( ) ;
501
- next. m . insert ( "foo" . to_owned ( ) , d) ;
502
- d = next;
503
- }
504
-
505
- let mut buf = Vec :: new ( ) ;
506
- d. encode ( & mut buf) . unwrap ( ) ;
507
- D :: decode ( buf. as_slice ( ) ) . map ( |_| ( ) )
508
- }
509
-
510
- assert ! ( build_and_roundtrip( 50 ) . is_ok( ) ) ;
511
- assert ! ( build_and_roundtrip( 51 ) . is_err( ) ) ;
512
- }
513
-
514
437
#[ test]
515
438
fn test_recursive_oneof ( ) {
516
439
use crate :: recursive_oneof:: { a, A , B , C } ;
0 commit comments