~singpolyma/dhall-ruby

ref: a1613a03bc9afb744eff17818f0c19f80b1813b3 dhall-ruby/test/test_cache_key.rb -rw-r--r-- 579 bytes
a1613a03Stephen Paul Weber Add cache_key test runner 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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