Skip to content

Commit 146bd37

Browse files
committed
Use Pathname properly in CiConfig::allowable_unittest_files
1 parent 48f5023 commit 146bd37

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
### Added
1010

1111
### Changed
12+
- `CiConfig::allowable_unittest_files` now uses `Pathname` to full effect
1213

1314
### Deprecated
1415

lib/arduino_ci/ci_config.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,17 +287,17 @@ def aux_libraries_for_unittest
287287
end
288288

289289
# Config allows select / reject (aka whitelist / blacklist) criteria. Enforce on a dir
290-
# @param paths [Array<String>] the initial set of test files
291-
# @return [Array<String>] files that match the select/reject criteria
290+
# @param paths [Array<Pathname>] the initial set of test files
291+
# @return [Array<Pathname>] files that match the select/reject criteria
292292
def allowable_unittest_files(paths)
293293
return paths if @unittest_info[:testfiles].nil?
294294

295295
ret = paths
296296
unless @unittest_info[:testfiles][:select].nil? || @unittest_info[:testfiles][:select].empty?
297-
ret = ret.select { |p| unittest_info[:testfiles][:select].any? { |glob| File.fnmatch(glob, File.basename(p)) } }
297+
ret.select! { |p| unittest_info[:testfiles][:select].any? { |glob| p.basename.fnmatch(glob) } }
298298
end
299299
unless @unittest_info[:testfiles][:reject].nil?
300-
ret = ret.reject { |p| unittest_info[:testfiles][:reject].any? { |glob| File.fnmatch(glob, File.basename(p)) } }
300+
ret.reject! { |p| unittest_info[:testfiles][:reject].any? { |glob| p.basename.fnmatch(glob) } }
301301
end
302302
ret
303303
end

0 commit comments

Comments
 (0)