()
| 929 | #[test] |
| 930 | #[should_panic] |
| 931 | fn copy_from_self() { |
| 932 | let pool = &mut ListPool::<Inst>::new(); |
| 933 | |
| 934 | let i1 = Inst::new(1); |
| 935 | let i2 = Inst::new(2); |
| 936 | let i3 = Inst::new(3); |
| 937 | let i4 = Inst::new(4); |
| 938 | |
| 939 | let mut list = EntityList::from_slice(&[i4, i3, i2, i1, i1, i2, i3, i4], pool); |
| 940 | let list_again = list; |
| 941 | assert_eq!(list.as_slice(pool), &[i4, i3, i2, i1, i1, i2, i3, i4]); |
| 942 | // Panic should occur on the line below because `list.index == other.index` |
| 943 | list.copy_from(&list_again, 0..=1, 8, pool); |
| 944 | assert_eq!( |
| 945 | list.as_slice(pool), |
| 946 | &[i4, i3, i2, i1, i1, i2, i3, i4, i4, i3] |
| 947 | ); |
| 948 | list.copy_from(&list_again, .., 7, pool); |
| 949 | assert_eq!( |
| 950 | list.as_slice(pool), |
| 951 | &[ |
| 952 | i4, i3, i2, i1, i1, i2, i4, i3, i2, i1, i1, i2, i3, i4, i4, i3, i3, i4, i4, i3 |
| 953 | ] |
| 954 | ) |
| 955 | } |
| 956 | } |
nothing calls this directly
no test coverage detected