aboutsummaryrefslogtreecommitdiff
path: root/bdep/new.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-09-02 14:41:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-09-02 14:41:51 +0200
commitbb25e12f0e15438d738806aed77ab63dc02cbe3c (patch)
tree9a80a2f64a3d119483658f874826f73033fe3700 /bdep/new.cxx
parent5b84b34eb1c4c49607a0d14706b15a6923f1ab0c (diff)
Fortify bdep-new-generated tests against NDEBUG
Diffstat (limited to 'bdep/new.cxx')
-rw-r--r--bdep/new.cxx28
1 files changed, 20 insertions, 8 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx
index a8f3af7..f02626a 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -1952,6 +1952,8 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
open (out_src / s + ".test.c");
os << "#include <stdio.h>" << '\n'
+ << '\n'
+ << "#undef NDEBUG" << '\n'
<< "#include <assert.h>" << '\n'
<< '\n'
<< "int main ()" << '\n'
@@ -1967,8 +1969,10 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// <src>/<stem>.test.<cxx-ext>
//
open (out_src / s + ".test" + xe);
- os << "#include <cassert>" << '\n'
- << "#include <iostream>" << '\n'
+ os << "#include <iostream>" << '\n'
+ << '\n'
+ << "#undef NDEBUG" << '\n'
+ << "#include <cassert>" << '\n'
<< '\n'
<< "int main ()" << '\n'
<< "{" << '\n'
@@ -2748,10 +2752,12 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
//
open (out_src / s + ".test.c");
os << "#include <stdio.h>" << '\n'
- << "#include <assert.h>" << '\n'
<< '\n'
<< "#include <" << ip << apih << ">" << '\n'
<< '\n'
+ << "#undef NDEBUG" << '\n'
+ << "#include <assert.h>" << '\n'
+ << '\n'
<< "int main ()" << '\n'
<< "{" << '\n'
<< " return 0;" << '\n'
@@ -2765,11 +2771,13 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// <src>/<stem>.test.<cxx-ext>
//
open (out_src / s + ".test" + xe);
- os << "#include <cassert>" << '\n'
- << "#include <iostream>" << '\n'
+ os << "#include <iostream>" << '\n'
<< '\n'
<< "#include <" << ip << apih << ">" << '\n'
<< '\n'
+ << "#undef NDEBUG" << '\n'
+ << "#include <cassert>" << '\n'
+ << '\n'
<< "int main ()" << '\n'
<< "{" << '\n'
<< '\n'
@@ -2915,12 +2923,14 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
os << "#include <stdio.h>" << '\n'
<< "#include <errno.h>" << '\n'
<< "#include <string.h>" << '\n'
- << "#include <assert.h>" << '\n'
<< '\n';
if (ver)
os << "#include <" << ip << verh << ">" << '\n';
os << "#include <" << ip << apih << ">" << '\n'
<< '\n'
+ << "#undef NDEBUG" << '\n'
+ << "#include <assert.h>" << '\n'
+ << '\n'
<< "#ifdef _WIN32" << '\n'
<< "#define tmpfile mytmpfile" << '\n'
<< "static FILE *mytmpfile ();" << '\n'
@@ -2994,14 +3004,16 @@ cmd_new (cmd_new_options&& o, cli::group_scanner& args)
// tests/basics/driver.<cxx-ext>
//
open (td / "driver" + xe);
- os << "#include <cassert>" << '\n'
- << "#include <sstream>" << '\n'
+ os << "#include <sstream>" << '\n'
<< "#include <stdexcept>" << '\n'
<< '\n';
if (ver)
os << "#include <" << ip << verh << ">" << '\n';
os << "#include <" << ip << apih << ">" << '\n'
<< '\n'
+ << "#undef NDEBUG" << '\n'
+ << "#include <cassert>" << '\n'
+ << '\n'
<< "int main ()" << '\n'
<< "{" << '\n'
<< " using namespace std;" << '\n'