| 1 | use Test2::V0scip-perl cpan FFI-Platypus 2.11 Test2/V0/ -no_srand => 1; |
| 2 | use libscip-perl cpan FFI-Platypus 2.11 lib/ 't/lib'; |
| 3 | use Test::Cleanupscip-perl cpan FFI-Platypus 2.11 Test/Cleanup/; |
| 4 | use FFI::Build::File::CXXscip-perl cpan FFI-Platypus 2.11 FFI/Build/File/CXX/; |
| 5 | use FFI::Buildscip-perl cpan FFI-Platypus 2.11 FFI/Build/; |
| 6 | use FFI::Build::Platformscip-perl cpan FFI-Platypus 2.11 FFI/Build/Platform/; |
| 7 | use Capture::Tinyscip-perl cpan FFI-Platypus 2.11 Capture/Tiny/ qw( capture_merged ); |
| 8 | |
| 9 | skip_allscip-perl cpan FFI-Platypus 2.11 main/skip_all(). 'Test requires C++ compiler' |
| 10 | unless eval { FFI::Build::Platform->whichscip-perl cpan FFI-Platypus 2.11 FFI/Build/Platform/which().(FFI::Build::Platform->cxxscip-perl cpan FFI-Platypus 2.11 FFI/Build/Platform/cxx().) }; |
| 11 | |
| 12 | subtestscip-perl cpan FFI-Platypus 2.11 main/subtest(). 'basic' => sub { |
| 13 | |
| 14 | my $file = FFI::Build::File::CXX->newscip-perl cpan FFI-Platypus 2.11 FFI/Build/File/CXX/new().(['corpus','ffi_build_file_cxx','basic.cxx']); |
| 15 | |
| 16 | isa_okscip-perl cpan FFI-Platypus 2.11 main/isa_ok(). $file, 'FFI::Build::File::CXX'; |
| 17 | isa_okscip-perl cpan FFI-Platypus 2.11 main/isa_ok(). $file, 'FFI::Build::File::C'; |
| 18 | isa_okscip-perl cpan FFI-Platypus 2.11 main/isa_ok(). $file, 'FFI::Build::File::Base'; |
| 19 | isscip-perl cpan FFI-Platypus 2.11 main/is().($file->default_suffixscip-perl cpan FFI-Platypus 2.11 FFI/Build/File/CXX/default_suffix()., '.cxx'); |
| 20 | isscip-perl cpan FFI-Platypus 2.11 main/is().($file->default_encodingscip-perl cpan FFI-Platypus 2.11 FFI/Build/File/CXX/default_encoding()., ':utf8'); |
| 21 | |
| 22 | }; |
| 23 | |
| 24 | subtestscip-perl cpan FFI-Platypus 2.11 main/subtest(). 'compile' => sub { |
| 25 | |
| 26 | my $file = FFI::Build::File::CXX->newscip-perl cpan FFI-Platypus 2.11 FFI/Build/File/CXX/new().([qw( corpus ffi_build_file_cxx foo1.cxx )]); |
| 27 | my $object = $file->build_itemscip-perl cpan FFI-Platypus 2.11 FFI/Build/File/CXX/build_item().; |
| 28 | isa_okscip-perl cpan FFI-Platypus 2.11 main/isa_ok(). $object, 'FFI::Build::File::Object'; |
| 29 | |
| 30 | is |
| 31 | [ $object->build_itemscip-perl cpan FFI-Platypus 2.11 main/build_item(). ], |
| 32 | []; |
| 33 | |
| 34 | cleanupscip-perl cpan FFI-Platypus 2.11 main/cleanup(). 'corpus/ffi_build_file_cxx/_build'; |
| 35 | |
| 36 | }; |
| 37 | |
| 38 | subtestscip-perl cpan FFI-Platypus 2.11 main/subtest(). 'headers' => sub { |
| 39 | |
| 40 | my $build = FFI::Build->newscip-perl cpan FFI-Platypus 2.11 FFI/Build/new().('foo', |
| 41 | verbose => 2, |
| 42 | cflags => "-Icorpus/ffi_build_file_cxx/include", |
| 43 | ); |
| 44 | |
| 45 | notescip-perl cpan FFI-Platypus 2.11 main/note(). "cflags=$_" for @{ $build->cflagsscip-perl cpan FFI-Platypus 2.11 FFI/Build/cflags(). }; |
| 46 | |
| 47 | my $file = FFI::Build::File::C->newscip-perl cpan FFI-Platypus 2.11 FFI/Build/File/C/new().([qw( corpus ffi_build_file_cxx foo2.cpp )], build => $build ); |
| 48 | |
| 49 | my @deps = eval { $file->_depsscip-perl cpan FFI-Platypus 2.11 FFI/Build/File/C/_deps(). }; |
| 50 | isscip-perl cpan FFI-Platypus 2.11 main/is(). $@scip-perl cpan FFI-Platypus 2.11 main/`$@`., '', 'no die'; |
| 51 | |
| 52 | foreach my $dep (@deps) |
| 53 | { |
| 54 | ok -fscip-perl cpan FFI-Platypus 2.11 main/f(). "$dep", "dep is afile: $dep"; |
| 55 | } |
| 56 | |
| 57 | }; |
| 58 | |
| 59 | done_testing; |