for-GET/katt — pull request #6 by odobroiu (2014-12-29 18:06:25+00:00)
Title: Validate type set

Readded the tests and added a couple simple ones more.

One small observation about the https://github.com/for-GET/katt/blob/validate_type_set/src/katt_validate_type.erl#L44 . The way the Unexpected value was extracted did not seem to be correct, and also the enumerated version of the data made it pretty messy to extract it. Also was not sure if I needed to look for ?UNEXPECTED elements or for {?MATCH_ANY : Value} elements, so looked for both.

Currently I think this should be functionally correct, but I think in the near future we would need to find a better solution for the get_unexpected method. There is also the create_callbacks method that I needed to use in the tests, and could not decide if I should export that from katt_util or not...

I also think that the project could benefit if the modules were somewhat more loosed coupled. Writing eunit tests is not that easy since you need to care about some extra things ( like comparing 2 structures could be a lot easier if it were called like katt_validator:validate(Expected :: katt_match_spec(), Actual :: json_term()) -> pass | {failed, list(katt_error()}. )

Btw, sorry for the late reply, but was surprised by how many holiday activities popped up. :) If you have any suggestings about the pr, I will be able to address them tonight. Not so sure about my schedule for tomorrow :)