~singpolyma/dhall-ruby

45f18465804af29516fead59d3ba2d4984cace32 — Stephen Paul Weber 2 years ago dc343b4
Anything we'll eventually run is a skip
4 files changed, 15 insertions(+), 20 deletions(-)

M lib/dhall/resolve.rb
M test/test_normalization.rb
M test/test_resolve.rb
M test/test_typechecker.rb
M lib/dhall/resolve.rb => lib/dhall/resolve.rb +1 -0
@@ 4,6 4,7 @@ require "set"
require "promise.rb"

require "dhall/ast"
require "dhall/binary"
require "dhall/util"

module Dhall

M test/test_normalization.rb => test/test_normalization.rb +2 -3
@@ 13,11 13,10 @@ class TestNormalization < Minitest::Test

	Pathname.glob(TESTS + "success/**/*A.dhall").each do |path|
		test = path.relative_path_from(TESTS).to_s.sub(/A\.dhall$/, "")
		next if test =~ /prelude\//
		next if test =~ /remoteSystems/
		next if test =~ /multiline\//

		define_method("test_#{test}") do
			skip "requires resolve" if test =~ /prelude\/|remoteSystems/

			Dhall::Function.disable_alpha_normalization! if test !~ /α/
			assert_equal(
				Dhall::Parser.parse_file(TESTS + "#{test}B.dhall").value,

M test/test_resolve.rb => test/test_resolve.rb +11 -16
@@ 6,12 6,9 @@ require "minitest/autorun"

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

class TestResolve < Minitest::Test
	DIRPATH = Pathname.new(File.dirname(__FILE__))
	TESTS = DIRPATH + "normalization/"

	def setup
		@resolver = Dhall::Resolvers::Default.new(
			path_reader: lambda do |sources|


@@ 230,19 227,17 @@ class TestResolve < Minitest::Test
		assert_equal Dhall::Variable["_"], expr.resolve.sync
	end

	DIRPATH = Pathname.new(File.dirname(__FILE__))
	TESTS = DIRPATH + "../dhall-lang/tests/normalization/"

	# Sanity check that all expressions can pass through the resolver
	Pathname.glob(TESTS + "**/*A.dhallb").each do |path|
		test = path.relative_path_from(TESTS).to_s.sub(/A\.dhallb$/, "")
		next if test =~ /prelude\//
		next if test =~ /remoteSystems/

		define_method("test_#{test.gsub(/\//, "_")}") do
			Dhall::Function.disable_alpha_normalization! if test =~ /^standard\//
			assert_equal(
				Dhall.from_binary((TESTS + "#{test}B.dhallb").binread),
				Dhall.from_binary(path.binread).resolve.sync.normalize
			)
			Dhall::Function.enable_alpha_normalization! if test =~ /^standard\//
	Pathname.glob(TESTS + "**/*A.dhall").each do |path|
		test = path.relative_path_from(TESTS).to_s.sub(/A\.dhall$/, "")
		next if test =~ /prelude\/|remoteSystems/

		define_method("test_#{test}") do
			expr = Dhall::Parser.parse_file(path).value
			assert_equal expr, expr.resolve.sync
		end
	end
end

M test/test_typechecker.rb => test/test_typechecker.rb +1 -1
@@ 12,9 12,9 @@ class TestTypechecker < Minitest::Test

	Pathname.glob(TESTS + "success/**/*A.dhall").each do |path|
		test = path.relative_path_from(TESTS).to_s.sub(/A\.dhall$/, "")
		next if test =~ /prelude/

		define_method("test_#{test}") do
			skip "needs resolve" if test =~ /prelude/
			assert_respond_to(
				Dhall::TypeChecker.for(
					Dhall::TypeAnnotation.new(