Skip to content

Commit

Permalink
Add compliance specs to the implicit conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
alextwoods authored and notEthan committed Jan 7, 2022
1 parent 31b740f commit ef7a16e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/implicit_conversion_spec.rb
Expand Up @@ -54,5 +54,33 @@ module JMESPath
end

end

describe 'Compliance' do
Dir.glob('spec/{compliance,legacy}/*.json').each do |path|

test_file = File.basename(path).split('.').first
next if test_file == 'benchmarks'
next if ENV['TEST_FILE'] && ENV['TEST_FILE'] != test_file

describe(test_file) do
JMESPath.load_json(path).each do |scenario|
describe("Given #{scenario['given'].to_json}") do
scenario['cases'].each do |test_case|

if !test_case['error']
it "searching #{test_case['expression'].inspect} returns #{test_case['result'].to_json}" do
result = JMESPath.search(test_case['expression'], Wrapper.wrap(scenario['given']))

expect(JMESPath::Util.as_json(result)).to eq(test_case['result'])
end

end
end
end
end
end
end
end

end
end

0 comments on commit ef7a16e

Please sign in to comment.