test/test_pdd.rb in pdd-0.17.3 vs test/test_pdd.rb in pdd-0.17.4
- old
+ new
@@ -20,13 +20,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
require 'minitest/autorun'
require 'nokogiri'
-require 'pdd'
require 'tmpdir'
require 'slop'
+require_relative '../lib/pdd'
# PDD main module test.
# Author:: Yegor Bugayenko (yegor@teamed.io)
# Copyright:: Copyright (c) 2014-2017 Yegor Bugayenko
# License:: MIT
@@ -66,20 +66,25 @@
set -e
cd '#{dir}'
git init .
git config user.email test@teamed.io
git config user.name 'Mr. Tester'
- echo '@todo #1 this is the puzzle' > .x.txt
- git add .x.txt
+ mkdir 'a long dir name'
+ cd 'a long dir name'
+ mkdir 'a kid'
+ cd 'a kid'
+ echo '@todo #1 this is the puzzle' > '.это файл.txt'
+ cd ../..
+ git add -f .
git commit -am 'first version'
")
matches(
Nokogiri::XML(PDD::Base.new(opts).xml),
[
'/puzzles[count(puzzle)=1]',
'/puzzles/puzzle[id]',
- '/puzzles/puzzle[file=".x.txt"]',
+ '/puzzles/puzzle[file="a long dir name/a kid/.это файл.txt"]',
'/puzzles/puzzle[author="Mr. Tester"]',
'/puzzles/puzzle[email="test@teamed.io"]',
'/puzzles/puzzle[time]'
]
)
@@ -87,14 +92,14 @@
end
private
def opts(args)
- Slop.parse args do
- on 'v', 'verbose'
- on 's', 'source', argument: :required
- on 'e', 'exclude', as: Array, argument: :required
- on 'r', 'rule', as: Array, argument: :required
+ Slop.parse args do |o|
+ o.bool '-v', '--verbose'
+ o.string '-s', '--source'
+ o.array '-e', '--exclude'
+ o.array '-r', '--rule'
end
end
def matches(xml, xpaths)
xpaths.each do |xpath|