Skip to content

Commit ef7a16e

Browse files
alextwoodsnotEthan
authored andcommitted
Add compliance specs to the implicit conversion
1 parent 31b740f commit ef7a16e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

spec/implicit_conversion_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,33 @@ module JMESPath
5454
end
5555

5656
end
57+
58+
describe 'Compliance' do
59+
Dir.glob('spec/{compliance,legacy}/*.json').each do |path|
60+
61+
test_file = File.basename(path).split('.').first
62+
next if test_file == 'benchmarks'
63+
next if ENV['TEST_FILE'] && ENV['TEST_FILE'] != test_file
64+
65+
describe(test_file) do
66+
JMESPath.load_json(path).each do |scenario|
67+
describe("Given #{scenario['given'].to_json}") do
68+
scenario['cases'].each do |test_case|
69+
70+
if !test_case['error']
71+
it "searching #{test_case['expression'].inspect} returns #{test_case['result'].to_json}" do
72+
result = JMESPath.search(test_case['expression'], Wrapper.wrap(scenario['given']))
73+
74+
expect(JMESPath::Util.as_json(result)).to eq(test_case['result'])
75+
end
76+
77+
end
78+
end
79+
end
80+
end
81+
end
82+
end
83+
end
84+
5785
end
5886
end

0 commit comments

Comments
 (0)