mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-22 12:17:36 -05:00
Custom assertion for a success of CommandResult
This commit is contained in:
@@ -128,6 +128,15 @@ class IntegrationTest < Test::Unit::TestCase
|
||||
TestLib.clear_env
|
||||
end
|
||||
|
||||
# extra assertions
|
||||
|
||||
def assert_success(res)
|
||||
msg = build_message(nil, "command status was expected to be a success, but failed with code <?> and STDERR:\n\n#{res.err}", res.status.to_i)
|
||||
assert_block(msg) { res.status.success? }
|
||||
end
|
||||
|
||||
# utils
|
||||
|
||||
def make_project(template_dir = nil)
|
||||
test_name = local_name
|
||||
test_name = test_name[5..] if test_name.start_with?('test_')
|
||||
|
||||
@@ -9,7 +9,7 @@ class Simple < IntegrationTest
|
||||
prj.create_lists_with package: 'CPMAddPackage("gh:cpm-cmake/testpack-adder#cad1cd4b4cdf957c5b59e30bc9a1dd200dbfc716")'
|
||||
cfg_result = prj.configure
|
||||
|
||||
assert cfg_result.status.success?
|
||||
assert_success cfg_result
|
||||
|
||||
cache = prj.read_cache
|
||||
|
||||
@@ -29,7 +29,7 @@ class Simple < IntegrationTest
|
||||
prj.create_lists_with package: 'CPMAddPackage("gh:cpm-cmake/testpack-adder@1.0.0")'
|
||||
cfg_result = prj.configure
|
||||
|
||||
assert cfg_result.status.success?
|
||||
assert_success cfg_result
|
||||
|
||||
cache = prj.read_cache
|
||||
|
||||
|
||||
Reference in New Issue
Block a user