Sha256: ca931524d92b104db17dc496beb083db016e6fa6e41583751cd5749607d7a95d

Contents?: true

Size: 1.75 KB

Versions: 4

Compression:

Stored size: 1.75 KB

Contents

# Copyright (c) 2014-2022 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
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require 'minitest/autorun'
require 'tmpdir'
require_relative '../lib/pdd'
require_relative '../lib/pdd/sources'

# Test many puzzles to make sure their IDs are correct.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
# License:: MIT
class TestMany < Minitest::Test
  def test_parsing
    Dir['./test_assets/puzzles/**'].each do |p|
      name = File.basename(p)
      list = PDD::Source.new("./test_assets/puzzles/#{name}", 'hey').puzzles
      assert_equal 1, list.size
      puzzle = list.first
      puts "#{name}: \"#{puzzle.props[:body]}\""
      next if name.start_with?('_')
      assert_equal name, puzzle.props[:id]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pdd-0.23.1 test/test_many.rb
pdd-0.23.0 test/test_many.rb
pdd-0.22.0 test/test_many.rb
pdd-0.21.3 test/test_many.rb