diff --git a/collects/meta/props b/collects/meta/props index 3f4592ac39..671e6a48a4 100755 --- a/collects/meta/props +++ b/collects/meta/props @@ -1802,6 +1802,7 @@ path/s is either such a string or a list of them. "collects/tests/units/test-unit.rktl" drdr:command-line (racket "-f" *) "collects/tests/unstable/byte-counting-port.rkt" responsible (jay) "collects/tests/unstable/generics.rkt" responsible (jay) +"collects/tests/unstable/port.rkt" responsible (stamourv) "collects/tests/unstable/srcloc.rktl" responsible (cce) drdr:command-line (racket "-f" *) "collects/tests/utils" responsible (unknown) "collects/tests/utils/gui.rkt" drdr:command-line (gracket-text "-t" *) @@ -1848,12 +1849,14 @@ path/s is either such a string or a list of them. "collects/unstable/match.rkt" responsible (samth) "collects/unstable/mutated-vars.rkt" responsible (samth) "collects/unstable/poly-c.rkt" responsible (samth) +"collects/unstable/port.rkt" responsible (stamourv) "collects/unstable/scribblings/byte-counting-port.scrbl" responsible (jay) "collects/unstable/scribblings/debug.scrbl" responsible (samth) "collects/unstable/scribblings/hash.scrbl" responsible (samth) "collects/unstable/scribblings/match.scrbl" responsible (samth) "collects/unstable/scribblings/mutated-vars.scrbl" responsible (samth) "collects/unstable/scribblings/poly-c.scrbl" responsible (samth) +"collects/unstable/scribblings/port.scrbl" responsible (stamourv) "collects/unstable/scribblings/sequence.scrbl" responsible (samth) "collects/unstable/scribblings/utils.rkt" responsible (samth) "collects/unstable/sequence.rkt" responsible (samth) diff --git a/collects/tests/unstable/port.rkt b/collects/tests/unstable/port.rkt new file mode 100644 index 0000000000..ba696bad44 --- /dev/null +++ b/collects/tests/unstable/port.rkt @@ -0,0 +1,23 @@ +#lang racket + +(require unstable/port + test-engine/scheme-tests) + +(check-expect (port? null-output-port) + #t) + +(check-expect (with-output-to-string + (lambda () + (parameterize ([current-output-port null-output-port]) + (display "can't see me")))) + "") + +(check-expect (with-output-to-string + (lambda () + (display "now you see me") + (parameterize ([current-output-port null-output-port]) + (display "now you don't")) + (display "you can see me again"))) + "now you see meyou can see me again") + +(test) diff --git a/collects/unstable/port.rkt b/collects/unstable/port.rkt new file mode 100644 index 0000000000..e4ac3b9757 --- /dev/null +++ b/collects/unstable/port.rkt @@ -0,0 +1,18 @@ +#lang racket/base + +(provide null-output-port) + +;; taken from section 12.1.9 of the reference +;; -- stamourv +(define null-output-port + (make-output-port + 'null + always-evt + (lambda (s start end non-block? breakable?) (- end start)) + void + (lambda (special non-block? breakable?) #t) + (lambda (s start end) (wrap-evt + always-evt + (lambda (x) + (- end start)))) + (lambda (special) always-evt))) diff --git a/collects/unstable/scribblings/port.scrbl b/collects/unstable/scribblings/port.scrbl new file mode 100644 index 0000000000..fe23087c11 --- /dev/null +++ b/collects/unstable/scribblings/port.scrbl @@ -0,0 +1,16 @@ +#lang scribble/doc +@(require scribble/base + scribble/manual + "utils.rkt" + (for-label unstable/port + racket/base)) + +@title[#:tag "port"]{Port} + +@defmodule[unstable/port] + +@unstable[@author+email["Vincent St-Amour" "stamourv@ccs.neu.edu"]] + +@defthing[null-output-port output-port?]{ + Output port that discards everything written to it. +} diff --git a/collects/unstable/scribblings/unstable.scrbl b/collects/unstable/scribblings/unstable.scrbl index 3fb0d3f56b..8be443cfc8 100644 --- a/collects/unstable/scribblings/unstable.scrbl +++ b/collects/unstable/scribblings/unstable.scrbl @@ -90,6 +90,7 @@ Keep documentation and tests up to date. @include-section["sequence.scrbl"] @include-section["hash.scrbl"] @include-section["match.scrbl"] +@include-section["port.scrbl"] @include-section["skip-list.scrbl"] @include-section["interval-map.scrbl"] @include-section["generics.scrbl"]