#!/usr/bin/env sh exec guile -L . -s "$0" "$@" !# (use-modules (potato make) (srfi srfi-1) (srfi srfi-64)) (test-begin "suffix_rules") ;; These stubs override the driver that calls ;; 'system' so we can instead just investigate ;; what string it was passed. (define %cmd #f) (define (stub-system-pass cmd) (set! %cmd cmd) 0) (define (stub-system-fail cmd) (set! %cmd cmd) 1) (test-assert "install alternate system driver" (false-if-exception (install-alternate-system-driver stub-system-pass))) #| (test-equal "Suffix rule using recipe helper and automatic variable." "cc -c foo.c" (begin (initialize '("test" "foo.o")) (-> ".c" ".o" (~ "cc -c" $<)) (: "foo.c" '() #t) (execute) %cmd)) (test-equal "Suffix rule using procedure returning #t." #t (begin (initialize '("test" "foo.o")) (-> ".c" ".o" (lambda () #t)) (: "foo.c" '() #t) (execute))) (test-equal "Suffix rule using procedure returning #f." #f (begin (initialize '("test" "foo.o")) (-> ".c" ".o" (lambda () #f)) (: "foo.c" '() #t) (execute))) (test-equal "Suffix rule using procedure returning string." "cc -o foo.o foo.c" (begin (initialize '("test" "foo.o")) (-> ".c" ".o" (lambda () "cc -o foo.o foo.c")) (: "foo.c" '() #t) (execute) %cmd)) |# (test-equal "Multiple possible suffix rules using procedure returning string." "dc -o foo.o foo.d" (begin (initialize '("test")) (: "all" '("foo.o")) (-> ".e" ".o" (lambda () "ec -o foo.o foo.e")) (-> ".d" ".o" (lambda () "dc -o foo.o foo.d")) (-> ".c" ".o" (lambda () "cc -o foo.o foo.c")) (: "foo.c" '() #f) (: "foo.d" '() #t) (: "foo.e" '() #f) (execute) %cmd)) (test-end "suffix_rules")