1 //===- llvm/unittest/ADT/MakeUniqueTest.cpp - make_unique unit tests ------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/ADT/STLExtras.h"
11 #include "gtest/gtest.h"
17 // Ensure that there is a default constructor and we can test for a null
19 TEST(FunctionRefTest
, Null
) {
20 function_ref
<int()> F
;
23 auto L
= [] { return 1; };
31 // Ensure that copies of a function_ref copy the underlying state rather than
32 // causing one function_ref to chain to the next.
33 TEST(FunctionRefTest
, Copy
) {
34 auto A
= [] { return 1; };
35 auto B
= [] { return 2; };
36 function_ref
<int()> X
= A
;
37 function_ref
<int()> Y
= X
;