From b431fdeb5fa72e130c8f05a8ab8f72926de747f1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 12 Jun 2017 12:49:03 +0200 Subject: Add initial tests for C++ modules support --- tests/cc/modules/buildfile | 8 ++++ tests/cc/modules/testscript | 107 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 tests/cc/modules/buildfile create mode 100644 tests/cc/modules/testscript (limited to 'tests') diff --git a/tests/cc/modules/buildfile b/tests/cc/modules/buildfile new file mode 100644 index 0000000..58caf92 --- /dev/null +++ b/tests/cc/modules/buildfile @@ -0,0 +1,8 @@ +# file : tests/cc/modules/buildfile +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +# Test C++ modules support. +# + +./: test{testscript} $b diff --git a/tests/cc/modules/testscript b/tests/cc/modules/testscript new file mode 100644 index 0000000..8f6fd96 --- /dev/null +++ b/tests/cc/modules/testscript @@ -0,0 +1,107 @@ +# file : tests/cc/modules/testscript +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +crosstest = false +test.arguments = config.cxx="$recall($cxx.path)" + +.include ../../common.test + ++cat <+build/bootstrap.build +using test +EOI + ++cat <=build/root.build +cxx.std = experimental +cxx.features.modules = true + +using cxx + +hxx{*}: extension = hxx +mxx{*}: extension = mxx +cxx{*}: extension = cxx + +exe{*}: test = true +EOI + +# Determine if we have module support. +# ++$* noop <=test.mxx +#if __cpp_modules >= 201704 +export +#endif +module foo.test; + +export int f (int); +EOI + ++cat <=test.cxx +module foo.test; +int f (int i) {return i - 1;} +EOI + ++cat <=driver.cxx +import foo.test; +int main (int argc, char*[]) {return f (argc);} +EOI + +: bmi-combined +: +: Test combined interface/implementation unit specified as bmi{}. +: +if ($cxx.id != "gcc") +cp ../test.mxx ./ && cat >+test.mxx <+test.mxx <