racket/pkgs/racket-test/tests/setup/matching-platform.rkt
Matthew Flatt 2d4f3e2ac9 remove the "racket-pkgs" directory layer
The layer is now redundant, since everything left in "pkgs" is in the
"racket-pkgs" category.
2014-12-08 05:22:59 -07:00

26 lines
1.2 KiB
Racket

#lang racket/base
(require setup/matching-platform
rackunit
racket/string)
(check-equal? #t (platform-spec? (system-type)))
(check-equal? #t (platform-spec? "string"))
(check-equal? #t (platform-spec? #rx"regexp"))
(check-equal? #f (platform-spec? #"bytes"))
(check-equal? #f (platform-spec? 11))
(check-equal? #t (matching-platform? (system-type)))
(check-equal? #f (matching-platform? 'no-such-system-type))
(check-equal? #t (matching-platform? 'unix #:system-type 'unix))
(check-equal? #t (matching-platform? 'windows #:system-type 'windows))
(check-equal? #t (matching-platform? (path->string (system-library-subpath #f))))
(check-equal? #f (matching-platform? "no-such-platform"))
(check-equal? #t (matching-platform? "no-such-platform" #:system-library-subpath (build-path "no-such-platform")))
(check-equal? #f (matching-platform? "no" #:system-library-subpath (build-path "no-such-platform")))
(check-equal? #t (matching-platform? #rx"."))
(check-equal? #t (matching-platform? (regexp-quote (path->string (system-library-subpath #f)))))
(check-equal? #f (matching-platform? #rx"^no-such-platform$"))
(check-equal? #t (matching-platform? #rx"^no-such-platform$" #:system-library-subpath (build-path "no-such-platform")))