From 21d7377fe3d205fcc020f61dc000d1303ef33831 Mon Sep 17 00:00:00 2001 From: James Ko Date: Wed, 12 Oct 2016 15:32:33 -0400 Subject: [PATCH] Remove all Throws* tests from ArrayBuilderTests --- .../Collections/Generic/ArrayBuilderTests.cs | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/src/Common/tests/Tests/System/Collections/Generic/ArrayBuilderTests.cs b/src/Common/tests/Tests/System/Collections/Generic/ArrayBuilderTests.cs index 20966ebadd23..9cdaf97113b2 100644 --- a/src/Common/tests/Tests/System/Collections/Generic/ArrayBuilderTests.cs +++ b/src/Common/tests/Tests/System/Collections/Generic/ArrayBuilderTests.cs @@ -26,10 +26,6 @@ public void ParameterlessConstructor() Assert.Equal(0, builder.Count); Assert.Equal(0, builder.Capacity); - // Indexing into the builder should throw - Assert.ThrowsAny(() => builder[0]); - Assert.ThrowsAny(() => builder[0] = default(T)); - // Should use a cached array for capacity of 0 Assert.Same(Array.Empty(), builder.ToArray()); } @@ -45,14 +41,6 @@ public void CapacityConstructor(int capacity) Assert.Equal(0, builder.Count); Assert.Equal(capacity, builder.Capacity); - // Indexing into the builder should be unchecked in Release builds, so the - // jit can optimize better and have an easier time inlining the method. - // So we may not throw an exception for builder[i] if the Capacity > i. - - // If we index @ Capacity and beyond, however, we should throw regardless of build config - Assert.ThrowsAny(() => builder[capacity]); - Assert.ThrowsAny(() => builder[capacity] = default(T)); - // Should use a cached array for count of 0, regardless of capacity Assert.Same(Array.Empty(), builder.ToArray()); } @@ -74,13 +62,6 @@ public void Count(int count) { T item = builder[i]; } - - // Again, builder[count] may not throw for Release builds unless - // Count == Capacity, so don't assert that here. - - // After Capacity, we should throw in Debug and Release builds. - Assert.ThrowsAny(() => builder[builder.Capacity]); - Assert.ThrowsAny(() => builder[builder.Capacity] = default(T)); } [Theory] @@ -137,10 +118,6 @@ public void UncheckedAdd(int capacity) } VerifyBuilderContents(Enumerable.Repeat(default(T), capacity), builder); - - // Count == Capacity now, so attempting to add more should raise - // an assert or generate an IndexOutOfRangeException - Assert.ThrowsAny(() => builder.UncheckedAdd(default(T))); } public static TheoryData CapacityData()