@@ -71,45 +71,42 @@ local options = {
7171 collect_all_errors = true
7272}
7373
74- describe (" [collect_all_errors - specialized tests]" , function ()
75- json .decode_array_with_array_mt (true )
76- local test_file = ' spec/extra/errors/collect_all_errors.json'
74+ json .decode_array_with_array_mt (true )
75+ local test_file = ' spec/extra/errors/collect_all_errors.json'
7776
78- for _ , suite in ipairs (readjson (test_file )) do
79- describe (" [ " .. test_file .. " ] " .. suite .description .. " :" , function ()
80- local schema = suite .schema
81- local validator
77+ for _ , suite in ipairs (readjson (test_file )) do
78+ describe (suite .description .. " :" , function ()
79+ local schema = suite .schema
80+ local validator
8281
83- lazy_setup (function ()
84- local val = assert (jsonschema .generate_validator (schema , options ))
85- assert .is_function (val )
86- validator = val
87- end )
82+ lazy_setup (function ()
83+ local val = assert (jsonschema .generate_validator (schema , options ))
84+ assert .is_function (val )
85+ validator = val
86+ end )
8887
89- for _ , case in ipairs (suite .tests ) do
90- it (case .description , function ()
91- if case .valid then
92- assert .has .no .error (function ()
93- assert (validator (case .data ))
94- end )
95- else
96- local result , errors
97- assert .has .no .error (function ()
98- result , errors = validator (case .data )
99- end )
88+ for _ , case in ipairs (suite .tests ) do
89+ it (case .description , function ()
90+ if case .valid then
91+ assert .has .no .error (function ()
92+ assert (validator (case .data ))
93+ end )
94+ else
95+ local result , errors
96+ assert .has .no .error (function ()
97+ result , errors = validator (case .data )
98+ end )
10099
101- -- Verify that result is false and errors is a table
102- assert .is_false (result )
103- assert .is_table (errors )
100+ -- Verify that result is false and errors is a table
101+ assert .is_false (result )
102+ assert .is_table (errors )
104103
105- -- Check error entries for collect_all_errors.json tests
106- if case .error_entries then
107- assert_contains_all_error_entries (errors , case .error_entries )
108- end
104+ -- Check error entries for collect_all_errors.json tests
105+ if case .error_entries then
106+ assert_contains_all_error_entries (errors , case .error_entries )
109107 end
110- end ) -- it
111- end -- for cases
112- end ) -- describe
113- end -- for suite
114-
115- end ) -- outer describe
108+ end
109+ end ) -- it
110+ end -- for cases
111+ end ) -- describe
112+ end -- for suite
0 commit comments