From ca089b24d48ef6fa8da2d0bb8c25bb802c4a95c0 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 13 Jul 2017 19:25:18 +0000 Subject: Vendor import of llvm trunk r307894: https://llvm.org/svn/llvm-project/llvm/trunk@307894 --- unittests/ADT/FunctionRefTest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'unittests/ADT/FunctionRefTest.cpp') diff --git a/unittests/ADT/FunctionRefTest.cpp b/unittests/ADT/FunctionRefTest.cpp index 075d9a070df7..b7ef7d79e5f9 100644 --- a/unittests/ADT/FunctionRefTest.cpp +++ b/unittests/ADT/FunctionRefTest.cpp @@ -14,6 +14,20 @@ using namespace llvm; namespace { +// Ensure that there is a default constructor and we can test for a null +// function_ref. +TEST(FunctionRefTest, Null) { + function_ref F; + EXPECT_FALSE(F); + + auto L = [] { return 1; }; + F = L; + EXPECT_TRUE(F); + + F = {}; + EXPECT_FALSE(F); +} + // Ensure that copies of a function_ref copy the underlying state rather than // causing one function_ref to chain to the next. TEST(FunctionRefTest, Copy) { -- cgit v1.2.3