Skip to content

Commit

Permalink
Skip some test files truffleruby can't parse
Browse files Browse the repository at this point in the history
Truffleruby's version of json/pure has a bug that's triggered by these
files. It's been fixed but the fix isn't in Truffleruby yet:

- flori/json#483
- flori/json#484

This skips the files when the error is raised and drops them before
checking fixtures.
  • Loading branch information
davishmcclurg committed Jun 7, 2023
1 parent 998e06d commit 538a1a5
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/json_schema_test_suite_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
require 'test_helper'

class JSONSchemaTestSuiteTest < Minitest::Test
INCOMPATIBLE_FILES = if RUBY_ENGINE == 'truffleruby'
# :nocov:
Set[
'JSON-Schema-Test-Suite/tests/draft4/optional/ecmascript-regex.json',
'JSON-Schema-Test-Suite/tests/draft6/optional/ecmascript-regex.json',
'JSON-Schema-Test-Suite/tests/draft7/optional/ecmascript-regex.json'
]
# :nocov:
else
Set[]
end

def test_json_schema_test_suite
ref_resolver = proc do |uri|
if uri.host == 'localhost'
Expand Down Expand Up @@ -43,13 +55,19 @@ def test_json_schema_test_suite
errors
end
end
rescue JSON::ParserError => e
# :nocov:
raise unless Encoding::CompatibilityError === e.cause && INCOMPATIBLE_FILES.include?(file)
# :nocov:
end

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

0 comments on commit 538a1a5

Please sign in to comment.