Skip to content

Commit

Permalink
Drop Truffleruby JSON hack
Browse files Browse the repository at this point in the history
The [fix](flori/json#483) must've made it fully
into Truffleruby now, because this isn't failing anymore.
  • Loading branch information
davishmcclurg committed Nov 28, 2023
1 parent 9809d60 commit da9c8f9
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions test/json_schema_test_suite_test.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
require 'test_helper'

class JSONSchemaTestSuiteTest < Minitest::Test
# https://github.com/flori/json/pull/483
INCOMPATIBLE_FILES = if RUBY_ENGINE == 'truffleruby' && Gem::Version.new(JSON::VERSION) < '2.6.3'
# :nocov:
Set[
'JSON-Schema-Test-Suite/tests/draft2020-12/optional/ecmascript-regex.json',
'JSON-Schema-Test-Suite/tests/draft2019-09/optional/ecmascript-regex.json',
'JSON-Schema-Test-Suite/tests/draft7/optional/ecmascript-regex.json',
'JSON-Schema-Test-Suite/tests/draft6/optional/ecmascript-regex.json',
'JSON-Schema-Test-Suite/tests/draft4/optional/ecmascript-regex.json'
]
# :nocov:
else
Set[]
end

OUTPUT_DRAFTS = {
'draft2020-12' => JSONSchemer.draft202012,
'draft2019-09' => JSONSchemer.draft201909
Expand Down Expand Up @@ -122,20 +107,14 @@ def test_json_schema_test_suite
# :nocov:
end
end
rescue JSON::ParserError => e
# :nocov:
raise unless Encoding::CompatibilityError === e.cause && INCOMPATIBLE_FILES.include?(file)
# :nocov:
end

fixture = Pathname.new(__dir__).join('fixtures', "#{draft}.json")
# :nocov:
if ENV['WRITE_FIXTURES'] == 'true'
fixture.write("#{JSON.pretty_generate(output)}\n")
else
fixture_json = JSON.parse(fixture.read)
INCOMPATIBLE_FILES.each { |file| fixture_json.delete(file) }
assert_equal(output, fixture_json)
assert_equal(output, JSON.parse(fixture.read))
end
# :nocov:
end
Expand Down

0 comments on commit da9c8f9

Please sign in to comment.