Skip to content

Commit 4b40f39

Browse files
committed
Add tests for SPDX with empty results #1011
Reported-by: Thorsten Harter <thorsten.harter@gmx.net> Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 360df15 commit 4b40f39

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# No results for package 'scan'.

tests/formattedcode/data/spdx/empty/scan/somefile

Whitespace-only changes.

tests/formattedcode/test_output_spdx.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,22 @@ def test_spdx_rdf_with_or_later_license_does_not_fail():
269269
'--license-diag', test_file, '--output-spdx-rdf', result_file]
270270
run_scan_plain(args)
271271
check_rdf_scan(expected_file, result_file)
272+
273+
274+
def test_spdx_tv_with_empty_scan():
275+
test_file = test_env.get_test_loc('spdx/empty/scan')
276+
result_file = test_env.get_temp_file('spdx.tv')
277+
expected_file = test_env.get_test_loc('spdx/empty/expected.tv')
278+
args = ['--license', '--strip-root', '--info', '--only-findings', test_file, '--output-spdx-tv', result_file]
279+
run_scan_plain(args)
280+
check_tv_scan(expected_file, result_file, regen=True)
281+
282+
283+
def test_spdx_rdf_with_empty_scan():
284+
test_file = test_env.get_test_loc('spdx/empty/scan')
285+
result_file = test_env.get_temp_file('spdx.rdf')
286+
args = ['--license', '--strip-root', '--info', '--only-findings', test_file, '--output-spdx-rdf', result_file]
287+
run_scan_plain(args)
288+
expected = "<!-- No results for package 'scan'. -->\n"
289+
results = open(result_file).read()
290+
assert expected == results

0 commit comments

Comments
 (0)