#30 Support multiple examples [fix #24]
Merged 5 years ago by psss. Opened 5 years ago by psss.

file modified
+2 -1
@@ -18,8 +18,9 @@ 

  EXAMPLES=$(patsubst examples/%.json,$(TMP)/%.test,$(wildcard examples/*.json))

  

  $(TMP)/%.test: examples/%.json $(SCHEMAS)

+ 	@$(eval SCHEMA=$(shell echo $* | sed "s/+.*//")) # Strip optional suffix

  	@echo -n "Checking $*... "

- 	@scripts/validate.py $(TMP)/$*.json $< >/dev/null

+ 	@scripts/validate.py $(TMP)/$(SCHEMA).json $< >/dev/null

  	@touch $@

  	@echo " passed."

  

file modified
+12
@@ -39,6 +39,18 @@ 

      ./scripts/validate.py schemas/brew-build.test.complete.json message.json

  

  

+ Examples

+ --------

+ 

+ Examples should have exactly the same name as the schema against

+ which they should be validated. Use optional suffix starting with

+ the "+" sign to test multiple examples against a single schema,

+ for example like this:

+ 

+     the-schema-name+simple.json

+     the-schema-name+complex.json

+ 

+ 

  Virtual topic namespace

  -----------------------

  

This fixes #24. The plus signs seems to be better delimiter as parenthesis.

@pholica's feedback from the issue:

That's great, I like the approach containing description. Plus sounds good too.

Thanks for the feedback. Merging.

Pull-Request has been merged by psss

5 years ago
Metadata