~singpolyma/dhall-ruby

ref: 71947f517530303b011cd4baf3616a1da41e63ae dhall-ruby/test/test_as_json.rb -rw-r--r-- 531 bytes
71947f51Stephen Paul Weber Keep around type information when we have it 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 "cbor"

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

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

	Pathname.glob(TESTS + "**/*.dhallb").each do |path|
		test = path.relative_path_from(TESTS).to_s.sub(/.dhallb$/, "")
		define_method("test_#{test}") do
			assert_equal(
				CBOR.decode(path.read).inspect,
				Dhall.from_binary(path.read).as_json.inspect
			)
		end
	end
end