Skip to content

Commit d5e7e88

Browse files
committed
Show mkmf.log contents even when pkg-config command failed
1 parent 06b14f2 commit d5e7e88

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/mkmf/test_pkg_config.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,26 @@ def test_pkgconfig_with_option_returns_nil_on_error
4646
def test_pkgconfig_with_libs_option_returns_output
4747
pend("skipping because pkg-config is not installed") unless PKG_CONFIG
4848
expected = ["-L#{@fixtures_lib_dir}", "-ltest1-public"].sort
49-
actual = pkg_config("test1", "libs").shellsplit.sort
50-
assert_equal(expected, actual, MKMFLOG)
49+
actual = pkg_config("test1", "libs")
50+
assert_equal_sorted(expected, actual, MKMFLOG)
5151
end
5252

5353
def test_pkgconfig_with_cflags_option_returns_output
5454
pend("skipping because pkg-config is not installed") unless PKG_CONFIG
5555
expected = ["--cflags-other", "-I#{@fixtures_inc_dir}/cflags-I"].sort
56-
actual = pkg_config("test1", "cflags").shellsplit.sort
57-
assert_equal(expected, actual, MKMFLOG)
56+
actual = pkg_config("test1", "cflags")
57+
assert_equal_sorted(expected, actual, MKMFLOG)
5858
end
5959

6060
def test_pkgconfig_with_multiple_options
6161
pend("skipping because pkg-config is not installed") unless PKG_CONFIG
6262
expected = ["-L#{@fixtures_lib_dir}", "-ltest1-public", "-ltest1-private"].sort
63-
actual = pkg_config("test1", "libs", "static").shellsplit.sort
64-
assert_equal(expected, actual, MKMFLOG)
63+
actual = pkg_config("test1", "libs", "static")
64+
assert_equal_sorted(expected, actual, MKMFLOG)
65+
end
66+
67+
private def assert_equal_sorted(expected, actual, msg = nil)
68+
actual = actual.shellsplit.sort if actual
69+
assert_equal(expected, actual, msg)
6570
end
6671
end

0 commit comments

Comments
 (0)