mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-18 07:07:47 -05:00
* Fixed: Deleted SOURCE_DIR directory would abort just after git stash save --quiet;--include-untracked * Fixed: Review comments * Added: Integration test for deleted SOURCE_DIR with FetchContent * Fixed: Review comments * Fixed: Review comments
37 lines
1.0 KiB
Ruby
37 lines
1.0 KiB
Ruby
require_relative './lib'
|
|
|
|
class RemoveSourceDir < IntegrationTest
|
|
def test_remove_source_dir
|
|
prj = make_project 'using-adder'
|
|
|
|
prj.create_lists_from_default_template package: <<~PACK
|
|
CPMAddPackage(
|
|
NAME testpack-adder
|
|
GITHUB_REPOSITORY cpm-cmake/testpack-adder
|
|
VERSION 1.0.0
|
|
OPTIONS "ADDER_BUILD_TESTS OFF"
|
|
SOURCE_DIR testpack-adder
|
|
)
|
|
PACK
|
|
|
|
# configure and build
|
|
assert_success prj.configure
|
|
assert_success prj.build
|
|
|
|
# source_dir is populated
|
|
assert_true File.exist?(File.join(prj.bin_dir, 'testpack-adder'))
|
|
|
|
# source_dir is deleted by user
|
|
FileUtils.remove_dir(File.join(prj.bin_dir, 'testpack-adder'), true)
|
|
assert_false File.exist?(File.join(prj.bin_dir, 'testpack-adder'))
|
|
|
|
# configure and build with missing source_dir to fetch new content
|
|
assert_success prj.configure
|
|
assert_success prj.build
|
|
|
|
# source_dir is populated
|
|
assert_true File.exist?(File.join(prj.bin_dir, 'testpack-adder'))
|
|
end
|
|
|
|
end
|