diff --git a/unittests/ADT/ArrayRefTest.cpp b/unittests/ADT/ArrayRefTest.cpp index 4d77c478f48..5912c05b13d 100644 --- a/unittests/ADT/ArrayRefTest.cpp +++ b/unittests/ADT/ArrayRefTest.cpp @@ -90,10 +90,23 @@ TEST(ArrayRefTest, ConstConvert) { a = ArrayRef(A); } +static ArrayRef ReturnTest12() { return {1, 2}; } +static void ArgTest12(ArrayRef A) { + EXPECT_EQ(2, A.size()); + EXPECT_EQ(1, A[0]); + EXPECT_EQ(2, A[1]); +} + TEST(ArrayRefTest, InitializerList) { ArrayRef A = { 0, 1, 2, 3, 4 }; for (int i = 0; i < 5; ++i) EXPECT_EQ(i, A[i]); + + A = ReturnTest12(); + EXPECT_EQ(1, A[0]); + EXPECT_EQ(2, A[1]); + + ArgTest12({1, 2}); } } // end anonymous namespace