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

Aaron Ballman aaron at aaronballman.com
Tue Feb 17 09:08:09 PST 2015


Author: aaronballman
Date: Tue Feb 17 11:08:08 2015
New Revision: 229513

URL: http://llvm.org/viewvc/llvm-project?rev=229513&view=rev
Log:
Adding additional tests to ensure that initializer lists created from return values and as function arguments also work as expected.

Modified:
    llvm/trunk/unittests/ADT/ArrayRefTest.cpp

Modified: llvm/trunk/unittests/ADT/ArrayRefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ArrayRefTest.cpp?rev=229513&r1=229512&r2=229513&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/ArrayRefTest.cpp (original)
+++ llvm/trunk/unittests/ADT/ArrayRefTest.cpp Tue Feb 17 11:08:08 2015
@@ -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





More information about the llvm-commits mailing list