Adding additional tests to ensure that initializer lists created from return values and as function arguments also work as expected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229513 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Aaron Ballman 2015-02-17 17:08:08 +00:00
parent fc25a7429b
commit 4e29d0712c

View File

@ -90,10 +90,23 @@ TEST(ArrayRefTest, ConstConvert) {
a = ArrayRef<int *>(A);
}
static ArrayRef<int> ReturnTest12() { return {1, 2}; }
static void ArgTest12(ArrayRef<int> A) {
EXPECT_EQ(2, A.size());
EXPECT_EQ(1, A[0]);
EXPECT_EQ(2, A[1]);
}
TEST(ArrayRefTest, InitializerList) {
ArrayRef<int> 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