Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vanir/scanners/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ py_test(
deps = [
":target_selection_strategy",
"//:signature",
"@com_google_absl_py//absl/logging",
"@com_google_absl_py//absl/testing:absltest",
],
)
Expand Down
18 changes: 16 additions & 2 deletions vanir/scanners/target_selection_strategy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import os
from unittest import mock

from absl import logging
from absl.testing import absltest
from vanir import signature
from vanir.scanners import target_selection_strategy

from absl.testing import absltest


class TargetSelectionStrategyTest(absltest.TestCase):

Expand Down Expand Up @@ -150,6 +150,20 @@ def test_truncated_path_match_raises_if_level_is_invalid(self):
self._test_dir.full_path, self._mock_sign_bundle
)

# Adding new test for validating PR intake.
def test_exact_path_match_strategy_from_file_set(self):
logging.info(
'Running test_exact_path_match_strategy_from_file_set test from'
' vanir/scanners/target_selection_strategy_test.py.'
)
file_set = {'exact_match1.c', 'foo/exact_match2.c', 'no_match.c'}
strategy = target_selection_strategy.Strategy.EXACT_PATH_MATCH
to_scan, skipped = strategy.get_target_files_from_file_set(
file_set, self._mock_sign_bundle
)
self.assertEqual(to_scan, {'exact_match1.c', 'foo/exact_match2.c'})
self.assertEqual(skipped, 1)


if __name__ == '__main__':
absltest.main()
Loading