diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-09-22 23:32:28 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-09-22 23:32:28 +0200 |
commit | c09cd7512491cee1e82c1ad8128ce9fd4bc3f79b (patch) | |
tree | a659ed768d849130ab5780a11b7f791a463a1a91 /tests | |
parent | 2a00871f07067f8f9e2de08bb9c8f50e1bf6a650 (diff) |
Initial modularization with both Clang and VC hacks
Note: gave up on VC about half way though.
Diffstat (limited to 'tests')
59 files changed, 740 insertions, 106 deletions
diff --git a/tests/base64/buildfile b/tests/base64/buildfile index 710499e..535b9dc 100644 --- a/tests/base64/buildfile +++ b/tests/base64/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/base64/driver.cxx b/tests/base64/driver.cxx index 040eaf8..fb65a49 100644 --- a/tests/base64/driver.cxx +++ b/tests/base64/driver.cxx @@ -2,11 +2,25 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <string> +#include <vector> #include <sstream> -#include <cassert> +#endif -#include <libbutl/base64.hxx> +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.base64; +#else +#include <libbutl/base64.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/build/root.build b/tests/build/root.build index 633ccb3..6c98ba9 100644 --- a/tests/build/root.build +++ b/tests/build/root.build @@ -2,6 +2,11 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file +using cxx.guess + +if ($force_modules != true && $cxx.id == 'clang') + cxx.features.modules = false + cxx.std = experimental using cxx diff --git a/tests/cpfile/buildfile b/tests/cpfile/buildfile index 0d95110..41275fa 100644 --- a/tests/cpfile/buildfile +++ b/tests/cpfile/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/cpfile/driver.cxx b/tests/cpfile/driver.cxx index 3a19322..db529ba 100644 --- a/tests/cpfile/driver.cxx +++ b/tests/cpfile/driver.cxx @@ -2,14 +2,29 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <ios> #include <string> -#include <cassert> #include <system_error> +#endif -#include <libbutl/path.hxx> -#include <libbutl/fdstream.hxx> -#include <libbutl/filesystem.hxx> +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.fdstream; +import butl.filesystem; +#else +#include <libbutl/path.mxx> +#include <libbutl/fdstream.mxx> +#include <libbutl/filesystem.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/curl/buildfile b/tests/curl/buildfile index 20617cf..dae375b 100644 --- a/tests/curl/buildfile +++ b/tests/curl/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/curl/driver.cxx b/tests/curl/driver.cxx index b5fc400..326d717 100644 --- a/tests/curl/driver.cxx +++ b/tests/curl/driver.cxx @@ -2,12 +2,35 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <iostream> #include <system_error> - -#include <libbutl/path.hxx> -#include <libbutl/utility.hxx> // operator<<(ostream, exception) -#include <libbutl/curl.hxx> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.curl; +import butl.path; +import butl.process; +import butl.utility; // operator<<(ostream, exception) +import butl.fdstream; + +import butl.optional; // @@ MOD Clang should not be necessary. +import butl.small_vector; // @@ MOD Clang should not be necessary. +#else +#include <libbutl/curl.mxx> +#include <libbutl/path.mxx> +#include <libbutl/process.mxx> +#include <libbutl/utility.mxx> +#include <libbutl/fdstream.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/dir-iterator/buildfile b/tests/dir-iterator/buildfile index e536536..7f83e4f 100644 --- a/tests/dir-iterator/buildfile +++ b/tests/dir-iterator/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/dir-iterator/driver.cxx b/tests/dir-iterator/driver.cxx index f584c68..1adef6f 100644 --- a/tests/dir-iterator/driver.cxx +++ b/tests/dir-iterator/driver.cxx @@ -2,14 +2,30 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <cstddef> // size_t #include <cassert> + +#ifndef __cpp_lib_modules +#include <cstddef> // size_t #include <iostream> +#endif + +// Other includes. -#include <libbutl/path.hxx> -#include <libbutl/path-io.hxx> -#include <libbutl/utility.hxx> // operator<<(ostream, exception) -#include <libbutl/filesystem.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.path_io; +import butl.utility; +import butl.filesystem; +#else +#include <libbutl/path.mxx> +#include <libbutl/path-io.mxx> +#include <libbutl/utility.mxx> // operator<<(ostream, exception) +#include <libbutl/filesystem.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/fdstream/buildfile b/tests/fdstream/buildfile index 5440bc1..6028f3f 100644 --- a/tests/fdstream/buildfile +++ b/tests/fdstream/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/fdstream/driver.cxx b/tests/fdstream/driver.cxx index 42414bc..dd70cff 100644 --- a/tests/fdstream/driver.cxx +++ b/tests/fdstream/driver.cxx @@ -2,6 +2,9 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #ifndef _WIN32 # include <chrono> # include <thread> // this_thread::sleep_for() @@ -11,18 +14,35 @@ #include <string> #include <vector> #include <iomanip> -#include <cassert> #include <sstream> #include <fstream> #include <utility> // move() #include <iostream> #include <exception> +#endif + +// Other includes. -#include <libbutl/path.hxx> -#include <libbutl/process.hxx> -#include <libbutl/fdstream.hxx> -#include <libbutl/timestamp.hxx> -#include <libbutl/filesystem.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#ifndef _WIN32 +//@@ MOD TODO import std.threading; +#endif +#endif +import butl.path; +import butl.process; +import butl.fdstream; +import butl.timestamp; +import butl.filesystem; +#else +#include <libbutl/path.mxx> +#include <libbutl/process.mxx> +#include <libbutl/fdstream.mxx> +#include <libbutl/timestamp.mxx> +#include <libbutl/filesystem.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/link/buildfile b/tests/link/buildfile index 9d4f6b5..17e3eac 100644 --- a/tests/link/buildfile +++ b/tests/link/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/link/driver.cxx b/tests/link/driver.cxx index a5e94bb..352cadd 100644 --- a/tests/link/driver.cxx +++ b/tests/link/driver.cxx @@ -2,14 +2,28 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <set> #include <cassert> + +#ifndef __cpp_lib_modules +#include <set> #include <utility> // pair #include <system_error> +#endif -#include <libbutl/path.hxx> -#include <libbutl/fdstream.hxx> -#include <libbutl/filesystem.hxx> +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +#endif +import butl.path; +import butl.fdstream; +import butl.filesystem; +#else +#include <libbutl/path.mxx> +#include <libbutl/fdstream.mxx> +#include <libbutl/filesystem.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/manifest-parser/buildfile b/tests/manifest-parser/buildfile index b57cac6..2a89e29 100644 --- a/tests/manifest-parser/buildfile +++ b/tests/manifest-parser/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/manifest-parser/driver.cxx b/tests/manifest-parser/driver.cxx index 037df96..76959e5 100644 --- a/tests/manifest-parser/driver.cxx +++ b/tests/manifest-parser/driver.cxx @@ -2,14 +2,27 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <vector> #include <string> #include <utility> // pair -#include <cassert> #include <sstream> #include <iostream> - -#include <libbutl/manifest-parser.hxx> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.manifest_parser; +#else +#include <libbutl/manifest-parser.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/manifest-roundtrip/buildfile b/tests/manifest-roundtrip/buildfile index a2fb3ac..5cd296f 100644 --- a/tests/manifest-roundtrip/buildfile +++ b/tests/manifest-roundtrip/buildfile @@ -4,5 +4,11 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs exe{driver}: test.roundtrip = manifest diff --git a/tests/manifest-roundtrip/driver.cxx b/tests/manifest-roundtrip/driver.cxx index 2068409..1f0b311 100644 --- a/tests/manifest-roundtrip/driver.cxx +++ b/tests/manifest-roundtrip/driver.cxx @@ -3,12 +3,29 @@ // license : MIT; see accompanying LICENSE file #include <cassert> + +#ifndef __cpp_lib_modules +#include <string> #include <iostream> +#endif + +// Other includes. -#include <libbutl/utility.hxx> // operator<<(ostream, exception) -#include <libbutl/fdstream.hxx> -#include <libbutl/manifest-parser.hxx> -#include <libbutl/manifest-serializer.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream, exception) +import butl.fdstream; +import butl.manifest_parser; +import butl.manifest_serializer; +#else +#include <libbutl/utility.mxx> +#include <libbutl/fdstream.mxx> +#include <libbutl/manifest-parser.mxx> +#include <libbutl/manifest-serializer.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/manifest-serializer/buildfile b/tests/manifest-serializer/buildfile index d13daab..df633ae 100644 --- a/tests/manifest-serializer/buildfile +++ b/tests/manifest-serializer/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/manifest-serializer/driver.cxx b/tests/manifest-serializer/driver.cxx index dad96bd..f373ecf 100644 --- a/tests/manifest-serializer/driver.cxx +++ b/tests/manifest-serializer/driver.cxx @@ -2,14 +2,27 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <vector> #include <string> #include <utility> // pair -#include <cassert> #include <sstream> #include <iostream> - -#include <libbutl/manifest-serializer.hxx> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.manifest_serializer; +#else +#include <libbutl/manifest-serializer.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/mventry/buildfile b/tests/mventry/buildfile index b665b61..d9af3a2 100644 --- a/tests/mventry/buildfile +++ b/tests/mventry/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/mventry/driver.cxx b/tests/mventry/driver.cxx index 5639c2b..eab2ce3 100644 --- a/tests/mventry/driver.cxx +++ b/tests/mventry/driver.cxx @@ -2,12 +2,28 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <iostream> #include <system_error> +#endif + +// Other includes. -#include <libbutl/path.hxx> -#include <libbutl/utility.hxx> // operator<<(ostream, exception) -#include <libbutl/filesystem.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.utility; // operator<<(ostream, exception) +import butl.filesystem; +#else +#include <libbutl/path.mxx> +#include <libbutl/utility.mxx> +#include <libbutl/filesystem.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/openssl/buildfile b/tests/openssl/buildfile index 7713f14..08b0878 100644 --- a/tests/openssl/buildfile +++ b/tests/openssl/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/openssl/driver.cxx b/tests/openssl/driver.cxx index b0e37ae..092b2ba 100644 --- a/tests/openssl/driver.cxx +++ b/tests/openssl/driver.cxx @@ -2,14 +2,36 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <vector> #include <iostream> #include <iterator> #include <system_error> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.utility; // operator<<(ostream, exception) +import butl.openssl; +import butl.process; +import butl.fdstream; // nullfd -#include <libbutl/path.hxx> -#include <libbutl/utility.hxx> // operator<<(ostream, exception) -#include <libbutl/openssl.hxx> +import butl.optional; // @@ MOD Clang should not be necessary. +import butl.small_vector; // @@ MOD Clang should not be necessary. +#else +#include <libbutl/path.mxx> +#include <libbutl/utility.mxx> +#include <libbutl/openssl.mxx> +#include <libbutl/fdstream.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/pager/buildfile b/tests/pager/buildfile index 1c1e9f4..d7d0123 100644 --- a/tests/pager/buildfile +++ b/tests/pager/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/pager/driver.cxx b/tests/pager/driver.cxx index 87c811d..6842cef 100644 --- a/tests/pager/driver.cxx +++ b/tests/pager/driver.cxx @@ -2,15 +2,28 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <ios> // ios_base::failure #include <vector> #include <string> #include <utility> // move() -#include <cassert> #include <sstream> #include <iostream> - -#include <libbutl/pager.hxx> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.pager; +#else +#include <libbutl/pager.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/path-entry/buildfile b/tests/path-entry/buildfile index 58e315c..e6515ae 100644 --- a/tests/path-entry/buildfile +++ b/tests/path-entry/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/path-entry/driver.cxx b/tests/path-entry/driver.cxx index 4f36f61..c69bf9c 100644 --- a/tests/path-entry/driver.cxx +++ b/tests/path-entry/driver.cxx @@ -2,11 +2,26 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <iostream> #include <system_error> - -#include <libbutl/utility.hxx> // operator<<(ostream, exception) -#include <libbutl/filesystem.hxx> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream, exception) +import butl.filesystem; +#else +#include <libbutl/utility.mxx> +#include <libbutl/filesystem.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/path/buildfile b/tests/path/buildfile index e7f19f2..aa39b2d 100644 --- a/tests/path/buildfile +++ b/tests/path/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/path/driver.cxx b/tests/path/driver.cxx index 4d859b3..c2919c0 100644 --- a/tests/path/driver.cxx +++ b/tests/path/driver.cxx @@ -3,11 +3,25 @@ // license : MIT; see accompanying LICENSE file #include <cassert> + +#ifndef __cpp_lib_modules #include <iostream> #include <type_traits> +#endif + +// Other includes. -#include <libbutl/path.hxx> -#include <libbutl/path-io.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.path_io; +#else +#include <libbutl/path.mxx> +#include <libbutl/path-io.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/prefix-map/buildfile b/tests/prefix-map/buildfile index 5c2dd69..140fda9 100644 --- a/tests/prefix-map/buildfile +++ b/tests/prefix-map/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/prefix-map/driver.cxx b/tests/prefix-map/driver.cxx index abf7e01..3e165b2 100644 --- a/tests/prefix-map/driver.cxx +++ b/tests/prefix-map/driver.cxx @@ -2,11 +2,24 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <string> #include <cassert> -#include <iostream> -#include <libbutl/prefix-map.hxx> +#ifndef __cpp_lib_modules +#include <string> +#include <iostream> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.prefix_map; +#else +#include <libbutl/prefix-map.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/process-run/buildfile b/tests/process-run/buildfile index 770357c..5200af7 100644 --- a/tests/process-run/buildfile +++ b/tests/process-run/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/process-run/driver.cxx b/tests/process-run/driver.cxx index 695fdb9..765bd7d 100644 --- a/tests/process-run/driver.cxx +++ b/tests/process-run/driver.cxx @@ -2,12 +2,31 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules +#include <string> #include <iostream> +#endif + +// Other includes. -#include <libbutl/path.hxx> -#include <libbutl/process.hxx> -#include <libbutl/fdstream.hxx> -#include <libbutl/small-vector.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.process; +import butl.optional; // @@ MOD Clang shouldn't be needed. +import butl.fdstream; +import butl.small_vector; +#else +#include <libbutl/path.mxx> +#include <libbutl/process.mxx> +#include <libbutl/fdstream.mxx> +#include <libbutl/small-vector.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/process/buildfile b/tests/process/buildfile index ddb4688..2ecc915 100644 --- a/tests/process/buildfile +++ b/tests/process/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/process/driver.cxx b/tests/process/driver.cxx index 0338af2..01f2c30 100644 --- a/tests/process/driver.cxx +++ b/tests/process/driver.cxx @@ -4,17 +4,34 @@ #include <stdlib.h> // getenv(), setenv(), _putenv() +#include <cassert> + +#ifndef __cpp_lib_modules #include <ios> #include <string> #include <vector> -#include <cassert> -#include <iostream> #include <iterator> // istreambuf_iterator, ostream_iterator #include <algorithm> // copy() +#include <iostream> +#endif + +// Other includes. -#include <libbutl/path.hxx> -#include <libbutl/process.hxx> -#include <libbutl/fdstream.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.process; +import butl.optional; +import butl.fdstream; +#else +#include <libbutl/path.mxx> +#include <libbutl/process.mxx> +#include <libbutl/optional.mxx> +#include <libbutl/fdstream.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/progress/buildfile b/tests/progress/buildfile index 19e85c0..d8cb6d6 100644 --- a/tests/progress/buildfile +++ b/tests/progress/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/progress/driver.cxx b/tests/progress/driver.cxx index 0ff68f0..c8c2080 100644 --- a/tests/progress/driver.cxx +++ b/tests/progress/driver.cxx @@ -4,20 +4,43 @@ #ifndef _WIN32 # include <unistd.h> // write() - -# include <thread> // this_thread::sleep_for() #else # include <libbutl/win32-utility.hxx> - # include <io.h> //_write() #endif +#include <cassert> + +#ifndef __cpp_lib_modules +#include <string> #include <cstddef> // size_t #include <iostream> +#ifndef _WIN32 +# include <thread> // this_thread::sleep_for() +#endif +#endif -#include <libbutl/process.hxx> -#include <libbutl/fdstream.hxx> // fdnull(), stderr_fd() -#include <libbutl/diagnostics.hxx> +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#ifndef _WIN32 +//@@ MOD TODO import std.threading; +#endif +#endif +import butl.process; +import butl.fdstream; +import butl.diagnostics; + +import butl.optional; // @@ MOD Clang should not be necessary. +import butl.small_vector; // @@ MOD Clang should not be necessary. +#else +#include <libbutl/process.mxx> +#include <libbutl/fdstream.mxx> // fdnull(), stderr_fd() +#include <libbutl/diagnostics.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/regex/buildfile b/tests/regex/buildfile index baf4bca..ae7e2c3 100644 --- a/tests/regex/buildfile +++ b/tests/regex/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/regex/driver.cxx b/tests/regex/driver.cxx index 054eb31..d48b716 100644 --- a/tests/regex/driver.cxx +++ b/tests/regex/driver.cxx @@ -2,13 +2,27 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <string> #include <cassert> + +#ifndef __cpp_lib_modules +#include <string> #include <iostream> #include <exception> +#endif + +// Other includes. -#include <libbutl/regex.hxx> -#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.regex; +import butl.utility; // operator<<(ostream, exception) +#else +#include <libbutl/regex.mxx> +#include <libbutl/utility.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/sendmail/buildfile b/tests/sendmail/buildfile index a83cf40..a854e89 100644 --- a/tests/sendmail/buildfile +++ b/tests/sendmail/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/sendmail/driver.cxx b/tests/sendmail/driver.cxx index e48c6b4..f5c9227 100644 --- a/tests/sendmail/driver.cxx +++ b/tests/sendmail/driver.cxx @@ -2,12 +2,34 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <iostream> #include <system_error> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.process; +import butl.utility; // operator<<(ostream, exception) +import butl.sendmail; +import butl.fdstream; -#include <libbutl/path.hxx> -#include <libbutl/utility.hxx> // operator<<(ostream, exception) -#include <libbutl/sendmail.hxx> +import butl.optional; // @@ MOD Clang should not be necessary. +import butl.small_vector; // @@ MOD Clang should not be necessary. +#else +#include <libbutl/path.mxx> +#include <libbutl/process.mxx> +#include <libbutl/utility.mxx> +#include <libbutl/sendmail.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/sha256/buildfile b/tests/sha256/buildfile index 627b78f..fb490d0 100644 --- a/tests/sha256/buildfile +++ b/tests/sha256/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/sha256/driver.cxx b/tests/sha256/driver.cxx index 2d2f963..191756c 100644 --- a/tests/sha256/driver.cxx +++ b/tests/sha256/driver.cxx @@ -1,12 +1,25 @@ -// file : tests/triplet/driver.cxx -*- C++ -*- +// file : tests/sha256/driver.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <string> #include <cassert> + +#ifndef __cpp_lib_modules +#include <string> #include <iostream> +#endif + +// Other includes. -#include <libbutl/sha256.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.sha256; +#else +#include <libbutl/sha256.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/small-vector/buildfile b/tests/small-vector/buildfile index 33be9ad..16d61f8 100644 --- a/tests/small-vector/buildfile +++ b/tests/small-vector/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/small-vector/driver.cxx b/tests/small-vector/driver.cxx index c7cafd4..fe386a4 100644 --- a/tests/small-vector/driver.cxx +++ b/tests/small-vector/driver.cxx @@ -2,11 +2,25 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <string> #include <cassert> -#include <iostream> -#include <libbutl/small-vector.hxx> +#ifndef __cpp_lib_modules +#include <string> +#include <vector> +#include <iostream> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.small_vector; +#else +#include <libbutl/small-vector.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/standard-version/buildfile b/tests/standard-version/buildfile index 0583b62..eb30733 100644 --- a/tests/standard-version/buildfile +++ b/tests/standard-version/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx index fa149ae..c6f9c11 100644 --- a/tests/standard-version/driver.cxx +++ b/tests/standard-version/driver.cxx @@ -2,14 +2,28 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <ios> // ios::failbit, ios::badbit #include <string> -#include <cassert> #include <iostream> #include <stdexcept> // invalid_argument - -#include <libbutl/utility.hxx> // operator<<(ostream,exception) -#include <libbutl/standard-version.hxx> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream,exception) +import butl.standard_version; +#else +#include <libbutl/utility.mxx> +#include <libbutl/standard-version.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/strcase/buildfile b/tests/strcase/buildfile index 71fec53..efe8442 100644 --- a/tests/strcase/buildfile +++ b/tests/strcase/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/strcase/driver.cxx b/tests/strcase/driver.cxx index f7f4bd1..285892d 100644 --- a/tests/strcase/driver.cxx +++ b/tests/strcase/driver.cxx @@ -2,10 +2,22 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <string> #include <cassert> -#include <libbutl/utility.hxx> +#ifndef __cpp_lib_modules +#include <string> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +#endif +import butl.utility; +#else +#include <libbutl/utility.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/string-parser/buildfile b/tests/string-parser/buildfile index 5969cd0..4613df1 100644 --- a/tests/string-parser/buildfile +++ b/tests/string-parser/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/string-parser/driver.cxx b/tests/string-parser/driver.cxx index 09443f2..f454a6f 100644 --- a/tests/string-parser/driver.cxx +++ b/tests/string-parser/driver.cxx @@ -2,17 +2,30 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <ios> // ios::failbit, ios::badbit -#include <vector> -#include <string> #include <cassert> + +#ifndef __cpp_lib_modules +#include <string> +#include <vector> #include <iostream> +#endif + +// Other includes. -#include <libbutl/utility.hxx> // operator<<(ostream,exception) -#include <libbutl/string-parser.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream,exception) +import butl.string_parser; +#else +#include <libbutl/utility.mxx> +#include <libbutl/string-parser.mxx> +#endif using namespace std; -using namespace butl; +using namespace butl::string_parser; // Usage: argv[0] [-l] [-u] [-p] // @@ -54,8 +67,7 @@ try string l; while (getline (cin, l)) { - vector<pair<string, size_t>> v ( - string_parser::parse_quoted_position (l, unquote)); + vector<pair<string, size_t>> v (parse_quoted_position (l, unquote)); if (!spl) { diff --git a/tests/tab-parser/buildfile b/tests/tab-parser/buildfile index 0583b62..eb30733 100644 --- a/tests/tab-parser/buildfile +++ b/tests/tab-parser/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/tab-parser/driver.cxx b/tests/tab-parser/driver.cxx index 238c12a..d5ff5a0 100644 --- a/tests/tab-parser/driver.cxx +++ b/tests/tab-parser/driver.cxx @@ -2,12 +2,26 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <ios> // ios::failbit, ios::badbit #include <cassert> + +#ifndef __cpp_lib_modules +#include <string> #include <iostream> +#endif + +// Other includes. -#include <libbutl/utility.hxx> // operator<<(ostream,exception) -#include <libbutl/tab-parser.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream,exception) +import butl.tab_parser; +#else +#include <libbutl/utility.mxx> +#include <libbutl/tab-parser.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/target-triplet/buildfile b/tests/target-triplet/buildfile index b8ca712..7dec846 100644 --- a/tests/target-triplet/buildfile +++ b/tests/target-triplet/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/target-triplet/driver.cxx b/tests/target-triplet/driver.cxx index b446a6f..5e61a46 100644 --- a/tests/target-triplet/driver.cxx +++ b/tests/target-triplet/driver.cxx @@ -3,10 +3,24 @@ // license : MIT; see accompanying LICENSE file #include <cassert> + +#ifndef __cpp_lib_modules +#include <string> #include <iostream> #include <stdexcept> // invalid_argument - -#include <libbutl/target-triplet.hxx> +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.target_triplet; +#else +#include <libbutl/target-triplet.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/timestamp/buildfile b/tests/timestamp/buildfile index 085daf0..c554fc3 100644 --- a/tests/timestamp/buildfile +++ b/tests/timestamp/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/timestamp/driver.cxx b/tests/timestamp/driver.cxx index 661deb2..ec4c49d 100644 --- a/tests/timestamp/driver.cxx +++ b/tests/timestamp/driver.cxx @@ -4,15 +4,28 @@ #include <time.h> // tzset() (POSIX), _tzset() (Windows) +#include <cassert> + +#ifndef __cpp_lib_modules #include <chrono> #include <locale> #include <clocale> -#include <cassert> #include <sstream> #include <iomanip> #include <system_error> +#endif -#include <libbutl/timestamp.hxx> +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.timestamp; +#else +#include <libbutl/timestamp.mxx> +#endif using namespace std; using namespace butl; diff --git a/tests/wildcard/buildfile b/tests/wildcard/buildfile index fc8e94b..90e8b58 100644 --- a/tests/wildcard/buildfile +++ b/tests/wildcard/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/wildcard/driver.cxx b/tests/wildcard/driver.cxx index 502726f..d95d7cd 100644 --- a/tests/wildcard/driver.cxx +++ b/tests/wildcard/driver.cxx @@ -2,18 +2,34 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include <cassert> + +#ifndef __cpp_lib_modules #include <map> #include <string> #include <vector> -#include <cassert> -#include <iostream> #include <algorithm> // sort() #include <exception> +#include <iostream> +#endif + +// Other includes. -#include <libbutl/path.hxx> -#include <libbutl/utility.hxx> // operator<<(ostream, exception) -#include <libbutl/optional.hxx> -#include <libbutl/filesystem.hxx> +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.utility; // operator<<(ostream, exception) +import butl.optional; +import butl.filesystem; +#else +#include <libbutl/path.mxx> +#include <libbutl/utility.mxx> +#include <libbutl/optional.mxx> +#include <libbutl/filesystem.mxx> +#endif using namespace std; using namespace butl; |