File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22#include < type_traits>
33
44#include " nix/util/fun.hh"
5+ #include " util-tests-config.hh"
56
67namespace nix {
78
@@ -39,19 +40,31 @@ TEST(fun, moveConstructFromStdFunction)
3940TEST (fun, rejectsEmptyStdFunction)
4041{
4142 std::function<int (int )> empty;
43+ #if HAVE_CXA_THROW
4244 ASSERT_DEATH ((fun<int (int )>{empty}), " invalid_argument" );
45+ #else
46+ EXPECT_THROW ((fun<int (int )>{empty}), std::invalid_argument);
47+ #endif
4348}
4449
4550TEST (fun, rejectsEmptyStdFunctionMove)
4651{
4752 std::function<int (int )> empty;
53+ #if HAVE_CXA_THROW
4854 ASSERT_DEATH ((fun<int (int )>{std::move (empty)}), " invalid_argument" );
55+ #else
56+ EXPECT_THROW ((fun<int (int )>{std::move (empty)}), std::invalid_argument);
57+ #endif
4958}
5059
5160TEST (fun, rejectsNullFunctionPointer)
5261{
5362 int (*nullFp)(int ) = nullptr ;
63+ #if HAVE_CXA_THROW
5464 ASSERT_DEATH ((fun<int (int )>{nullFp}), " invalid_argument" );
65+ #else
66+ EXPECT_THROW ((fun<int (int )>{nullFp}), std::invalid_argument);
67+ #endif
5568}
5669
5770TEST (fun, nullptrDeletedAtCompileTime)
Original file line number Diff line number Diff line change @@ -36,16 +36,17 @@ deps_private += gtest
3636gmock = dependency (' gmock' )
3737deps_private += gmock
3838
39+ subdir (' nix-meson-build-support/common' )
40+
3941configdata = configuration_data ()
4042configdata.set_quoted(' PACKAGE_VERSION' , meson .project_version())
43+ configdata.set(' HAVE_CXA_THROW' , have_cxa_throw.to_int())
4144
4245config_priv_h = configure_file (
4346 configuration : configdata,
4447 output : ' util-tests-config.hh' ,
4548)
4649
47- subdir (' nix-meson-build-support/common' )
48-
4950sources = files (
5051 ' alignment.cc' ,
5152 ' archive.cc' ,
You can’t perform that action at this time.
0 commit comments