Implementing `make check` or `make test`

后端 未结 4 911
生来不讨喜
生来不讨喜 2021-01-30 11:35

How can I implement a simple regression test framework with Make? (I’m using GNU Make, if that matters.)

My current makefile looks something like this (edited for simpl

4条回答
  •  再見小時候
    2021-01-30 11:47

    What I ended up with looks like this:

    TESTS = whitespace list boolean character \
        literal fixnum string symbol quote
    
    .PHONY: clean test
    
    test: $(JSCHEME)
        for t in $(TESTS); do \
            $(JSCHEME) < test/$$t.ss > test/$$t.out 2>&1; \
            diff test/$$t.out test/$$t.cmp > /dev/null || \
                echo Test $$t failed >&2; \
        done
    

    It’s based on Jack Kelly’s idea, with Jonathan Leffler’s tip included.

提交回复
热议问题