~singpolyma/dhall-ruby

a1613a03bc9afb744eff17818f0c19f80b1813b3 — Stephen Paul Weber 3 years ago 21c688d
Add cache_key test runner
1 files changed, 23 insertions(+), 0 deletions(-)

A test/test_cache_key.rb
A test/test_cache_key.rb => test/test_cache_key.rb +23 -0
@@ 0,0 1,23 @@
# frozen_string_literal: true

require "minitest/autorun"
require "pathname"

require "dhall/binary"
require "dhall/parser"
require "dhall/normalize"

class TestCacheKey < Minitest::Test
	DIRPATH = Pathname.new(File.dirname(__FILE__))
	TESTS = DIRPATH + "../dhall-lang/tests/semantic-hash/success/"

	Pathname.glob(TESTS + "**/*A.dhall").each do |path|
		test = path.relative_path_from(TESTS).to_s.sub(/A\.dhall$/, "")
		define_method("test_#{test}") do
			assert_equal(
				(TESTS + "#{test}B.dhall").read.chomp,
				Dhall::Parser.parse_file(path).cache_key
			)
		end
	end
end