Custom assertion for a success of CommandResult

This commit is contained in:
Borislav Stanimirov
2022-01-12 08:39:06 +02:00
parent 7c9c42fad6
commit 5b162bedc1
2 changed files with 11 additions and 2 deletions

View File

@@ -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_')

View File

@@ -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