aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/parser.test.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/cc/parser.test.cxx')
-rw-r--r--libbuild2/cc/parser.test.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/libbuild2/cc/parser.test.cxx b/libbuild2/cc/parser.test.cxx
index e5b3f6a..2270d32 100644
--- a/libbuild2/cc/parser.test.cxx
+++ b/libbuild2/cc/parser.test.cxx
@@ -1,7 +1,6 @@
// file : libbuild2/cc/parser.test.cxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
-#include <cassert>
#include <iostream>
#include <libbuild2/types.hxx>
@@ -9,6 +8,9 @@
#include <libbuild2/cc/parser.hxx>
+#undef NDEBUG
+#include <cassert>
+
using namespace std;
using namespace butl;
@@ -42,16 +44,25 @@ namespace build2
}
parser p;
- unit u (p.parse (is, in));
- unit_type ut (u.type);
+ unit u (p.parse (is, in, compiler_id (compiler_type::gcc, "")));
+
+ switch (u.type)
+ {
+ case unit_type::module_intf:
+ case unit_type::module_intf_part:
+ cout << "export ";
+ // Fall through.
+ case unit_type::module_impl:
+ case unit_type::module_impl_part:
+ cout << "module " << u.module_info.name << ';' << endl;
+ break;
+ default:
+ break;
+ }
for (const module_import& m: u.module_info.imports)
cout << (m.exported ? "export " : "")
<< "import " << m.name << ';' << endl;
-
- if (ut == unit_type::module_iface || ut == unit_type::module_impl)
- cout << (ut == unit_type::module_iface ? "export " : "")
- << "module " << u.module_info.name << ';' << endl;
}
catch (const failed&)
{