test/test_sources.rb in pdd-0.20.6 vs test/test_sources.rb in pdd-0.20.7
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (c) 2014-2020 Yegor Bugayenko
+# Copyright (c) 2014-2021 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -24,11 +24,11 @@
require_relative '../test/test__helper'
require_relative '../lib/pdd/sources'
# Sources test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
-# Copyright:: Copyright (c) 2014-2020 Yegor Bugayenko
+# Copyright:: Copyright (c) 2014-2021 Yegor Bugayenko
# License:: MIT
class TestSources < Minitest::Test
def test_iterator
in_temp(['a.txt', 'b/c.txt']) do |dir|
list = PDD::Sources.new(dir).fetch
@@ -83,9 +83,23 @@
end
def test_excludes_recursively
in_temp(['a/first.txt', 'b/c/second.txt', 'b/c/d/third.txt']) do |dir|
list = PDD::Sources.new(dir).exclude('**/*').fetch
+ assert_equal 0, list.size
+ end
+ end
+
+ def test_includes_by_pattern
+ in_temp(['a/first.txt', 'b/c/d/second.txt']) do |dir|
+ list = PDD::Sources.new(dir).include('b/c/d/second.txt').fetch
+ assert_equal 1, list.size
+ end
+ end
+
+ def test_includes_recursively
+ in_temp(['a/first.txt', 'b/c/second.txt', 'b/c/d/third.txt']) do |dir|
+ list = PDD::Sources.new(dir).include('**/*').fetch
assert_equal 0, list.size
end
end
def test_fails_with_verbose_output