You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
1.1 KiB

  1. # Rebuild the README.md file at repo root by inserting code samples
  2. # from compilable go files.
  3. SHELL=/bin/bash
  4. GOCLOUD_HOME=$(GOPATH)/src/cloud.google.com/go
  5. README=$(GOCLOUD_HOME)/README.md
  6. .PHONY: readme test test-good test-bad-go test-bad-md
  7. readme:
  8. @tmp=$$(mktemp); \
  9. awk -f snipmd.awk snippets.go $(README) > $$tmp; \
  10. mv $$tmp $(README)
  11. diff:
  12. diff $(README) <(awk -f snipmd.awk snippets.go $(README))
  13. test: test-good test-bad-go test-bad-md
  14. @echo PASS
  15. test-good:
  16. @echo testdata/good.md
  17. @cd testdata >& /dev/null; \
  18. diff -u want.md <(awk -f ../snipmd.awk snips.go good.md)
  19. @echo "testdata/want.md (round trip)"
  20. @cd testdata >& /dev/null; \
  21. diff -u want.md <(awk -f ../snipmd.awk snips.go want.md)
  22. test-bad-go:
  23. @for f in testdata/bad-*.go; do \
  24. echo $$f; \
  25. if awk -f snipmd.awk $$f >& /dev/null; then \
  26. echo "$f succeeded, want failure"; \
  27. exit 1; \
  28. fi; \
  29. done
  30. test-bad-md:
  31. @for f in testdata/bad-*.md; do \
  32. echo $$f; \
  33. if awk -f snipmd.awk testdata/snips.go $$f >& /dev/null; then \
  34. echo "$f succeeded, want failure"; \
  35. exit 1; \
  36. fi; \
  37. done