File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff 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
5886end
You can’t perform that action at this time.
0 commit comments